Hide a jCarousel when page loads

后端 未结 2 1671
旧巷少年郎
旧巷少年郎 2021-01-21 06:29

I need to do something similar to this:

jQuery(\'#ImgCarousel\').jcarousel({});
jQuery(\'#ImgCarouselCon\').hide();

ImgCarouselCon is the conta

相关标签:
2条回答
  • 2021-01-21 06:43

    You could set the position of the container element to be position:absolute and left:-999em (or some sufficiently large number), so it's still "displayed" for jcarousel to be able to set it up, but it's not anywhere visible on the page.

    Then when you want to display it, just change it to position:static and it will jump back into where it should be for the page. Or if you're going to animate it somehow, call jQuery('#ImgCarouselCon').hide() first, then position:static (ideally through a CSS class that does that), then do whatever animation or whatnot you want to do to show it.

    0 讨论(0)
  • 2021-01-21 06:44

    Try the initCallback option:

    jQuery('#ImgCarousel').jcarousel({
        initCallback: function() {jQuery('#ImgCarouselCon').hide();}
    });
    
    0 讨论(0)
提交回复
热议问题