// apply fitvids functionality to .entry-content div // https://github.com/davatron5000/FitVids.js THANKS TO SCOTT NIX OF THE CHILD'S PLAY THEME jQuery(document).ready(function($) { $(".entry-content").fitVids(); }); //SHOW OR HIDE THE MENU jQuery(document).ready(function($) { //THANKS TO TONAL, BY AUTOMATTIC function showSection() { var menu = $('#mobile-button'); var menuShow = $('#mobile-menu'); function switchClass($myvar) { if ($myvar.hasClass('active')) { $myvar.removeClass('active'); } else { $myvar.addClass('active'); } } menu.on('click', function() { switchClass($(this)); menuShow.slideToggle(); }); } $(window).on('load', showSection); }); // RULES FOR STICKINESS, ETC jQuery(document).ready(function($){ setTimeout(function(){ if ($(window).width() > 768) { $.waypoints.settings.scrollThrottle = 0; $("#site-header-sticky").css( 'height', 0 + $("#site-header").outerHeight()); $("#top-container-sticky").css( 'height', 0 + $("#top-container").outerHeight()); $("#container").css( 'min-height', 0 + $.waypoints('viewportHeight') - $("#site-header").outerHeight() - $("#wpadminbar").outerHeight() - $("#footer-container").outerHeight() - $("#top-container").outerHeight()); $("#site-header").addClass( 'stuck' ); $("#site-header").css( 'top', 0 + $("#wpadminbar").outerHeight()); if ( $("#top-container").outerHeight() <= ($.waypoints('viewportHeight') - $("#site-header").outerHeight() - $("#wpadminbar").outerHeight())) { $("#top-container").addClass( 'stuck' ); } $("#footer-container").waypoint(function(direction) { if (direction == 'down') { $("#site-header").removeClass( 'stuck' ); $("#site-header").css( 'top', 0 + $("#page").outerHeight() - $("#footer-container").outerHeight() - $("#site-header").outerHeight()); } else if (direction == 'up') { $("#site-header").addClass( 'stuck' ); $("#site-header").css( 'top', 0 + $("#wpadminbar").outerHeight()); } }, {offset: function() { return 0 + $("#site-header").outerHeight() + $("#wpadminbar").outerHeight(); }}); } }, 63); }); //SLOW SCROLL TO THE TOP OF THE PAGE jQuery(document).ready(function($){ $('a.scrolltotop').click(function(){ $('html, body').animate({scrollTop:0}, 'slow'); return false; }); }); //RULES FOR THE POSITIONING OF THE AUTOSCROLL jQuery(document).ready(function($){ setTimeout(function(){ $( window ).resize(function(){ var adminbar = 0 + $("#wpadminbar").outerHeight(); var screenheight = $.waypoints('viewportHeight'); var screenwidth = 0 + $(window).width(); var realwidth = 0 + $("#page").outerWidth(); var gutter = ((screenwidth - realwidth) / 2); $(".autoscroll-bottom").css( 'top', screenheight - 68); $(".autoscroll-bottom").css( 'left', realwidth + gutter - 86); $("body").waypoint(function(direction) { if (direction == 'down'){ $(".autoscroll-bottom").css( 'display', 'block'); } else { $(".autoscroll-bottom").css( 'display', 'none'); } }, {offset: -screenheight}); }).resize(); }, 63); }); //SLIDES! // Can also be used with $(document).ready() jQuery(document).ready(function($){ $('#featured-posts').flexslider({ animation: "fade", slideshowSpeed: 15000, pauseOnHover: true, directionNav: true, controlNav: false, smoothHeight: false, prevText: "", nextText: "" }); $('#top-content').flexslider({ animation: "fade", slideshowSpeed: 10000, pauseOnHover: false, directionNav: false, controlNav: true, smoothHeight: false, prevText: "", nextText: "" }); $('.flexslider').flexslider({ animation: "fade", slideshowSpeed: 8000, directionNav: false, controlNav: true, pausePlay: false, smoothHeight: false, pauseOnHover: false, prevText: "", nextText: "" }); }); //SIZING IMAGES IN SLIDES { jQuery(document).ready(function($){ if ($('#top-content img').outerHeight() > 650) { $('#top-content img').css( 'max-height', '650px' ); //$('#top-content img').css( 'height', '100%' ); $('#top-content img').css( 'width', 'auto' ); } });