i would like to fix my margin-left value on resize. I try to write a horizontal slider.
this is my html markup. Section floats left and article got the width of all sections.... the #mainSlider has a variable Width.
<div id="mainSlider" class="c12" >
<article class="slides">
<section>1</section>
<section>2</section>
<section>3</section>
<section>4</section>
</article>
</div>
and this is the test snippet who should worke but it does not;) WHY?
th3width = function(){
wd = $('#mainSlider').innerWidth();
$('article').css({'margin-left' : - wd +"px" });
}
th3width();
$(window).resize(function(){
th3width();
});
use marginLeft not 'margin-left' ? http://jsfiddle.net/snsuu27x/
.css({marginLeft : wd+'px'})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.