jquery - Scrolling Causes Stuttering In Responsive Slider -
i've been working on fun solution create full page image slider that's responsive viewers browser, , once browser scrolls allows user see content below.
i used bit of jquery , thought had found solution worked perfectly! until got end of project , tried scroll , down. noticed when scroll , down framerate seems bit choppy. doing research people saying may because of ".animate" in jquery. goal here avoid plug-ins , wondering if 1 offer me helpful solution? i'm new jquery , web development in general i've created code pen project may able fork , me out.
here jquery:
function slideswitch() { var $active = $('.image.active'); if ( $active.length === 0 ) $active = $('.image:last'); var $next = $active.next().length ? $active.next() : $('.image:first'); $active.addclass('last-active'); $next.css({opacity: 0}) .addclass('active') .animate({opacity: 1}, 600, function() { $active.removeclass('active last-active'); }); } $(function() { setinterval( "slideswitch()", 6000 ); });
there quite abit of css project, may more helpful if post code pen here: http://codepen.io/develonaut/pen/rjvsn
thank help!
Comments
Post a Comment