javascript - Bootstrap carousel: changing jquery slides to bootstrap caroulsel and binding a slide function -


i started applying bootstrap on site. need change following script work on bootstrap carousel

        $(function(){             // set starting slide 1             var startslide = 1;             // slide number if exists             if (window.location.hash) {                 alert('hash'+window.location.hash);                 startslide = window.location.hash.replace('#','');                 alert('startslide'+startslide);             }             // initialize slides             $('#slides2').slides({                 preload: true,                 preloadimage: 'img/loading.gif',                 generatepagination: true,                 play: 0,                 pause: 2500,                  hoverpause: true,                 currentclass: 'current',                 // starting slide                 start: {$startnumb},                 animationcomplete: function(current){                     // set slide number hash                     window.location.hash = '#' + current;                     alert('windows hash'+window.location.hash);                     alert('current'+current);                     $('#activeslideindex').val(current);                     $('#poplightbox div.rating a').attr('rel', imageidarray[current-1] +';media');                     $('#poplightbox a.votenegative').html('<img src="{$livesite}/templates/{$theme}/desktop_images/images/unlike.png" align="absmiddle"><b class="sprite">&nbsp;</b> ' + votecountarray[current-1][0]);                     $('#poplightbox a.voteplus').html('<img src="{$livesite}/templates/{$theme}/desktop_images/images/approve.png" align="absmiddle"><b class="sprite">&nbsp;</b> ' + votecountarray[current-1][1]);                 }             }); 

i've tried not working. don't know current variable getting value , how window.location.hash work

    $(function(){         // set starting slide 1           var startslide = 1;         // slide number if exists         if (window.location.hash) {             startslide = window.location.hash.replace('#','');         }         $('#mycarousel').bind('slide',function(current){              window.location.hash = '#' + current;             $('#activeslideindex').val(current);             $('#poplightbox div.rating a').attr('rel', imageidarray[current-1] +';media');             $('#poplightbox a.votenegative').html('<img src="{$livesite}/templates/{$theme}/desktop_images/images/unlike.png" align="absmiddle"><b class="sprite">&nbsp;</b> ' + votecountarray[current-1][0]);             $('#poplightbox a.voteplus').html('<img src="{$livesite}/templates/{$theme}/desktop_images/images/approve.png" align="absmiddle"><b class="sprite">&nbsp;</b> ' + votecountarray[current-1][1]);     });           });  

found solution.this 1 gets current index of carousel

$('#mycarousel').bind('slid',function(e){               var current =  $(".active", e.target).index()+1;                    $('#activeslideindex').val(current);                 $('#poplightbox div.rating a').attr('rel', imageidarray[current-1] +';media');                 $('#poplightbox a.votenegative').html('<img src="{$livesite}/templates/{$theme}/desktop_images/images/unlike.png" align="absmiddle"><b class="sprite">&nbsp;</b> ' + votecountarray[current-1][0]);                 $('#poplightbox a.voteplus').html('<img src="{$livesite}/templates/{$theme}/desktop_images/images/approve.png" align="absmiddle"><b class="sprite">&nbsp;</b> ' + votecountarray[current-1][1]);         });   

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -