/* * jQuery throttle / debounce - v1.1 - 3/7/2010 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ * use it to call a function $(window).scroll( $.throttle( 250, scroll_2 ) ); function scroll_2() { };// This is the line you want! * use it at the top of a function jQuery(window).scroll(jQuery.throttle(500, function ($) { })); */ ;(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); /* Check to see if the window is top if not then display button */ jQuery(document).ready(function($) { /* Make all newsflash divs the same height as container div */ var currheight = jQuery('.newsflash-horiz').innerHeight(); if(currheight > 0){ //currheight +=10; jQuery('.newsflash-horiz').children('[class^="flash"]').css('height', currheight); } //jQuery('.newsflash-horiz').find('.readmore').addClass('btn btn-primary'); $(window).scroll(function(){ if ($(this).scrollTop() > 50) { $('#scroll-prompt').fadeOut(); } else { $('#scroll-prompt').fadeIn(); } if ($(this).scrollTop() > 850) { $('#back2top').fadeIn(); } else { $('#back2top').fadeOut(); } }); //Click event to scroll to top $('#back2top').click(function(){ $('html, body').animate({scrollTop : 0},800); return false; }); }); /* jQuery(document).ready(function() { var currheight = jQuery('.newsflash-horiz').innerHeight(); var readheight = jQuery('.readmore').innerHeight(); if(currheight > 0){ currheight = currheight + readheight; jQuery('.newsflash-horiz').children("div").css('height', currheight); } //jQuery('.newsflash-horiz').find('.readmore').addClass('btn btn-primary'); }); */ // Find all YouTube videos (function($){ var $allVideos = $("iframe[src^='//www.youtube.com']"), // The element that is fluid width $fluidEl = $("body"); // Figure out and save aspect ratio for each video $allVideos.each(function() { $(this) .data('aspectRatio', this.height / this.width) // and remove the hard coded width/height .removeAttr('height') .removeAttr('width'); }); // When the window is resized $(window).resize(function() { var newWidth = $fluidEl.width(); // Resize all videos according to their own aspect ratio $allVideos.each(function() { var $el = $(this); $el .width(newWidth) .height(newWidth * $el.data('aspectRatio')); }); // Kick off one resize to fix all videos on page load }).resize(); })(jQuery);