Question

I'm trying to use jQuery EasySlider to carousel, however, when I specify a number in percentage for the width of the div container, the container fails to deliver content.

Am I to assume that it is incapable of dealing with percentages?

Was it helpful?

Solution

Does the container div have floating children? If true, that's why the div doesn't show any content (floating elements are taken out of the document flow and thus out of the parent element, which in turn will collapse to 0 width when there are no no-floating children).

OTHER TIPS

In EasySlider 1.7 It should work just fine. The relevant code in the plugin is:

var w = $("li", obj).width(); 

.width() in jQuery returns the value in pixels even if it is specified in the CSS as a percentage. Whether you specify percentage or pixels, it's effectively the same.

Which version of EasySlider are you using?

Use this ancient Math equation:

function getPercentage(percent, original)
{
    return ((percent/100) * original))|0;
}

Customize the code as you want, It just gets the desired percentage of any number!.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top