/** * cf-scrips.js * * Handles the Bootstrap Carousel, Boostrap Back To Top and isInViewport.min.js */ $(document).ready(function() { var slideqty = $('#fade-quote-carousel .item').length; var randSlide = Math.floor(Math.random()*slideqty); $('#fade-quote-carousel .item').eq(randSlide).addClass('active'); for (var i=0; i < slideqty; i++) { var insertText = '
'; $('#fade-quote-carousel ol').append(insertText); } }); $('.carousel').carousel({ interval: 6000 //changes the speed }) // Only enable if the document has a long scroll bar // Note the window height + offset if ( ($(window).height() + 100) < $(document).height() ) { $('#top-link-block').removeClass('hidden').affix({ // how far to scroll down before link "slides" into view offset: {top:100} }); } jQuery(function() { jQuery(window).scroll(function() { jQuery('.wp-video-shortcode').each(function() { var str = jQuery(this).attr('id'); var arr = str.split('_'); typecheck = arr[0]; if (jQuery(this).is(":in-viewport( 400 )") && typecheck == "mep") { mejs.players[jQuery(this).attr('id')].media.play(); } else if (typecheck == "mep") { mejs.players[jQuery(this).attr('id')].media.stop(); } }); }); });