jQuery slider carousel stop at end -
all right. building custom carousel simple javascript , css3. working okay far. however. when continue clicking next button(when slider @ end), continues without stop function (so become out of focus , messy). i have created small fiddle
the code minified down following:
function nextslide(){ counter++; var slidewidth = articlewidth*counter; var articles = $('#slider article.boxed').length; //magic css3 $('.carousel>div').css('-webkit-transform', 'translate3d('+-slidewidth+'px, 0px, 0px)'); $('.carousel>div').css('-ms-transform', 'translate3d('+-slidewidth+'px, 0px, 0px)'); $('.carousel>div').css('transform', 'translate3d('+-slidewidth+'px, 0px, 0px)'); }
i have tried calculating stop pos in terms of width/number of slides(articles), buggy, guess, , looking fluid work css responsive (shown in fiddle). suggestions? :)
hope below link you.
$('.block-13 .show-more.prev').click(function () { var last = $('.block-13 .list li:last-child'); last.remove(); $('.block-13 .list').filter(':not(:animated)').prepend(last); $('.block-13 .list').filter(':not(:animated)').css({ right: '+=' + width }); $('.block-13 .list').filter(':not(:animated)').animate({ right: '-=' + width });
});
Comments
Post a Comment