jquery - AnythingSlider is undefined -
i'm using anythingslider jquery plugin photogallery , i'm having problems in customizing it.
the slider works, right want show current slide number , total number , i'm getting error in firebug.
the script this:
$(function() { var current = $('#gallery').data('anythingslider').currentpage; var pages = $('#gallery').data('anythingslider').pages; $('.slides').append(current + '/' + pages); $('#gallery').anythingslider({ appendbackto: '.arrow-left', appendforwardto: '.arrow-right', buildnavigation: false, buildstartstop: false, easing: 'linear', resizecontents: false //expand: true }) });
without first 3 lines works, firebug says $("#gallery").data("anythingslider") undefined.
it because data('anythingslider')
not available before plugin initialization, place following lines
var current = $('#gallery').data('anythingslider').currentpage; var pages = $('#gallery').data('anythingslider').pages; $('.slides').append(current + '/' + pages);
bottom of these lines
$('#gallery').anythingslider({ appendbackto: '.arrow-left', appendforwardto: '.arrow-right', buildnavigation: false, buildstartstop: false, easing: 'linear', resizecontents: false //expand: true });
if else right should work. data('anythingslider')
available when plugin initialized because these data added plugin , until these data undefined
.
Comments
Post a Comment