javascript - JQuery change width that given in percent issue. -



javascript - JQuery change width that given in percent issue. -

i using script smiling slider http://codepen.io/zuraizm/pen/vgdhl,

but when seek set #slider ul li width 90% in css want work, i've checked js , if utilize percent width intend of pixel homecoming me 0 value

var slidewidth = $('#slider ul li').width();

but if illustration set #slider ul li width 100px; in css calculate in right way.

i have read percent , pixels different , seems says $('#slider ul li').width() should homecoming px instead of percent, homecoming 0 me.

just want create slider 90% width , max-width 760 px, when alter width causes on calculation js.

you're setting ul slidecount * slidewidth. if you're slide 500px width 4 slides, ul width 2000px. if li width set 90%, that's 1800px. see?

you want set each li width same slider width, add together line in middle code:

... $('#slider ul').css({ width: sliderulwidth, marginleft: - slidewidth }); $('#slider ul li').css({ width: slidewidth }); $('#slider ul li:last-child').prependto('#slider ul'); ...

you determine slide width styling li, when setting you're slider jquery, add together css #slider , ul. i'd suggest setting height , width on #slider , removing ul , li. check fiddle: http://jsfiddle.net/hfbmma1r/

javascript jquery

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -