slider.js 798 B

123456789101112131415161718192021222324252627282930313233
  1. ( function( $ ) {
  2. function loadFlexslider() {
  3. $( '.flex-viewport-wrapper' ).flexslider( {
  4. animation: "fade",
  5. slideshow: false,
  6. animationLoop: true,
  7. controlNav: false,
  8. directionNav: $('.flexslider .slides > .hero-content-wrapper').length > 1, //Hide navigation controls when we only have 1 post.
  9. carousel: false,
  10. itemMargin: 0,
  11. itemWidth: 1180,
  12. itemHeight: 600,
  13. smoothHeight: true,
  14. selector: '.slides > .hero-content-wrapper',
  15. start: function(){
  16. window.dispatchEvent(new Event('resize'));
  17. },
  18. } );
  19. }
  20. function refreshFlexslider() {
  21. $( '.flex-viewport-wrapper' ).imagesLoaded( function() {
  22. window.dispatchEvent(new Event('resize'));
  23. });
  24. }
  25. $(document).on( 'ready', function() {
  26. loadFlexslider();
  27. refreshFlexslider();
  28. } );
  29. } )(jQuery);