jquery - I want to add auto slide to this script can any one help me out? -


hi friends have image slider on site

slides images click on preview , next button.

my question is: possible add auto start instead of onclik ?

here codes:
want add auto slide script can 1 me out?? doesn't have auto play option. slides on mouse click event.

 $(document).ready(function () {          var showcaseitems = $('.show-case-item').hide();          var splashes = $('.splash').hide();         //get each image each slide , set background of slide         //            splashes.each(function () {         //                var img = $(this).find('img');         //                var imgsrc = img.attr('src');         //                img.css('visibility', 'hidden');         //                $(this).css({ 'background-image': 'url(' + imgsrc + ')', 'background-repeat': 'no-repeat' });         //            });          splashes.eq(0).show();         showcaseitems.eq(0).show();          var previndex = -1;         var nextindex = 0;         var currentindex = 0;          $('#banner-pagination li a').click(function () {                nextindex = parseint($(this).attr('rel'));              if (nextindex != currentindex) {                 $('#banner-pagination li a').html('<img src="assets/img/slidedot.png" alt="slide"/>');                 $(this).html('<img src="assets/img/slidedot-active.png" alt="slide"/>');                 currentindex = nextindex;                 if (previndex < 0) previndex = 0;                  splashes.eq(previndex).css({ opacity: 1 }).animate({ opacity: 0 }, 500, function () {                     $(this).hide();                 });                 splashes.eq(nextindex).show().css({ opacity: 0 }).animate({ opacity: 1 }, 500, function () { });                  showcaseitems.eq(previndex).css({ opacity: 1 }).animate({ opacity: 0 }, 500, function () {                     $(this).hide();                     showcaseitems.eq(nextindex).show().css({ opacity: 0 }).animate({ opacity: 1 }, 200, function () { });                 });                  previndex = nextindex;             }              return false;         });       }); 

i presume have ul inside div called banner-pagination. hard without seeing html. if don't should have. ul should surround lis

jquery(document).ready(function ($) {  var slidecount = $('#banner-pagination ul li a').length; var slidewidth = $('#banner-pagination ul li a').width(); var slideheight = $('#banner-pagination ul li a').height(); var sliderulwidth = slidecount * slidewidth;  $('#banner-pagination').css({ width: slidewidth, height: slideheight });  $('#banner-pagination ul').css({ width: sliderulwidth, marginleft: - slidewidth });  $('#banner-pagination ul li:last-child').prependto('#slider ul');  function moveleft() {     $('#banner-pagination ul').animate({         left: + slidewidth     }, 1000, function () {         $('#banner-pagination ul li:last-child').prependto('#slider ul');         $('#banner-pagination ul').css('left', '');     }); };   function do_slide(){     interval = setinterval(function(){       moveleft();     }, 1000);   }   do_slide();    $('ul li').hover(function(){    clearinterval(interval);  });   $('ul li').mouseleave(function(){    do_slide();  });  });  

reference


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -