im currently learning jQuery and have ran into a problem. I am trying to use the liteAccordion library (found here: http://nicolahibbert.com/demo/liteAccordion/)
i want to have a button to hide the "accordion" but since it has autoPlay, i get a bunch of error. I was wondering how i can temporarily turn off the autoPlay. ie: how can i modify the autoPlay value of the object. The object is created as follows:
$('#mainNavigation').liteAccordion({
onActivate : function() {
开发者_开发百科 this.find('figcaption').fadeOut();
},
slideCallback : function() {
this.find('figcaption').fadeIn();
},
autoPlay : true,
pauseOnHover : true,
theme : 'colorful',
rounded : true
})
Try referencing the main div, which lite accordion uses;using jquery hide for example: you can use $('#one').hide() to hide the div on lite accordion page. http://nicolahibbert.com/demo/liteAccordion/ (the div which is the main container for accordion ,has an id ="one")
or refer the accordion while you create, using a variable
myAccordion = $('#two').liteAccordion();
now use jquery functions on the variable
$(myAccordion).hide();
etc
If you can't figure out how to turn off the auto play, instead of hiding it the normal way you can try to hide it by setting position:absolute
to a value way off screen like:
$('#mainNavigation').css({ position:'absolute', left:'-99999em' });
Since it's using absolute positioning you won't get any unwanted scroll bars.
精彩评论