Perform an action before a transition (callback)

  • The Velvet Underground & Nico
    The Velvet Underground
  • White Light / White Heat
    The Velvet Underground
  • The Velvet Underground
    The Velvet Underground
  • Loaded
    The Velvet Underground

Click a slide control and wait for the callback.

jQuery: 
$(function(){
  $('#slider1').bxSlider({
    pager: true,
    onBeforeSlide: function(currentSlide, totalSlides){
      $('.field-name-field-custom .field-item').append('<p class="check">Slide index ' + currentSlide + ' of ' + totalSlides + ' total slides has completed.');
    }
  });
});
Notes:
  • Slide indecies are zero based.
  • onAfterSlide will fire on page load and the first slide will be the target.
  • onBeforeSlide will not fire on page load.
  • The third parameter for the callback methods passes in the current slide jQuery object