(function($){ var scroll_ok = true; setInterval(function () { scroll_ok = true; }, 33);//33ms is 30fps, you can try changing this to something larger for better performance var scroll_ok2 = true; setInterval(function () { scroll_ok2 = true; }, 33);//33ms is 30fps, you can try changing this to something larger for better performance var scroll_ok3 = true; setInterval(function () { scroll_ok3 = true; }, 33);//33ms is 30fps, you can try changing this to something larger for better performance var scroll_ok4 = true; setInterval(function () { scroll_ok4 = true; }, 33);//33ms is 30fps, you can try changing this to something larger for better performance $(window).resize(function(){ pageReInit(); }); function pageReInit(){ refreshAnchors(); getWidth(); var Stickies = $(".stickywrapper"); addstickypositions(Stickies); $(window).scrollTop($(window).scrollTop()+1); $('.equalheight').each(function(){ $(this).find(".col").equalHeights(); }); } function pageInit(){ var newStickies = new stickyTitles(jQuery(".stickywrapper")); newStickies.load(); $(window).scroll(function(){ if (scroll_ok === true) { newStickies.scroll(); scroll_ok = false; } }); refreshAnchors(); getWidth(); initsidebarslide(); $(window).scrollTop($(window).scrollTop()+1); } function html_entity_decode(str){ /*Firefox (and IE if the string contains no elements surrounded by angle brackets )*/ try{ var ta=document.createElement("textarea"); ta.innerHTML=str; return ta.value; }catch(e){}; /*Internet Explorer*/ try{ var d=document.createElement("div"); d.innerHTML=str.replace(//g,">"); if(typeof d.innerText!="undefined")return d.innerText;/*Sadly this strips tags as well*/ }catch(e){} } function addstickypositions(stickies){ stickies.each(function(){ var thisSticky = jQuery(this); thisSticky.parent().height(thisSticky.outerHeight()); jQuery.data(thisSticky[0], 'pos', thisSticky.parent().offset().top); }); } function stickyTitles(stickies) { this.load = function() { stickies.each(function(){ var thisSticky = jQuery(this).wrap('
'); }); addstickypositions(stickies); } this.scroll = function() { if (scroll_ok2 === true) { stickies.each(function(i){ var thisSticky = jQuery(this), nextSticky = stickies.eq(i+1), prevSticky = stickies.eq(i-1), pos = jQuery.data(thisSticky[0], 'pos'); if (pos <= jQuery(window).scrollTop() + 34) { thisSticky.addClass("fixed"); if (nextSticky.length > 0 && thisSticky.offset().top >= jQuery.data(nextSticky[0], 'pos') - thisSticky.outerHeight()) { thisSticky.addClass("absolute").css("top", jQuery.data(nextSticky[0], 'pos') - thisSticky.outerHeight()); } } else { thisSticky.removeClass("fixed"); if (prevSticky.length > 0 && jQuery(window).scrollTop() + 34 <= jQuery.data(thisSticky[0], 'pos') - prevSticky.outerHeight()) { prevSticky.removeClass("absolute").removeAttr("style"); } } }); scroll_ok2 = false; } } } function ourPicksSliderBehavior(){ $('.button-1').click(function(){ $('.slide').stop().fadeOut(function(){ }); $('.slide-1').fadeIn(); $('.button').removeClass('activ'); $(this).addClass('activ'); }); $('.button-2').click(function(){ $('.slide').fadeOut(function(){ }); $('.slide-4').fadeIn(); $('.button').removeClass('activ'); $(this).addClass('activ'); }); $('.button-3').click(function(){ $('.slide').fadeOut(function(){ }); $('.slide-8').fadeIn(); $('.button').removeClass('activ'); $(this).addClass('activ'); }); $('.button-4').click(function(){ $('.slide').fadeOut(function(){ }); $('.slide-12').fadeIn(); $('.button').removeClass('activ'); $(this).addClass('activ'); }); } $.fn.equalHeights = function(minHeight, maxHeight) { tallest = (minHeight) ? minHeight : 0; this.each(function() { if($(this).height() > tallest) { tallest = $(this).height(); } }); if((maxHeight) && tallest > maxHeight) tallest = maxHeight; return this.each(function() { $(this).height(tallest).css("overflow","hidden"); }); } function sticky_relocate() { var window_top = $(window).scrollTop(); var div_top = $('.page').offset().top; if ((div_top-window_top) < 0){ if(!($('#menuwrap').hasClass('stick'))){ $('#menuwrap').addClass('stick'); $('#up').show(); } }else{ if(($('#menuwrap').hasClass('stick'))){ $('#menuwrap').removeClass('stick'); $('#up').hide(); } } } function initsidebarslide(){ if( ($('#articlecontent').is('*')) && ($('#sidebarcontent').is('*')) ){ var box1 = $('#articlecontent'); var box2 = $('#sidebarcontent'); es_init(box1,box2); } } $(window).load(function(){ $('.showMenu').click(function(){ $('#menu').show(); $('#menu').animate({width:'300px'},300); return false; }); $('#menu').click(function(){ $('#menu').animate({width:'0px'},300,function(){ $('#menu').hide(); return false; }); }); pageInit(); }); $(document).ready(function(){ ourPicksSliderBehavior(); $('.equalheight').each(function(){ $(this).find(".col").equalHeights(); }); $(window).scroll(function(){ if (scroll_ok3 === true) { sticky_relocate(); scroll_ok3 = false; } }); $('.views-field-title').each(function(){ $(this).html(html_entity_decode($(this).html())); }); $('.isotitle').each(function(){ $(this).html(html_entity_decode($(this).html())); }); $('h1').each(function(){ $(this).html(html_entity_decode($(this).html())); }); $('.views-field-field-push-to').each(function(){ $(this).html(html_entity_decode($(this).html())); }); }); function filterPath(string) { return string .replace(/^\//,'') .replace(/(index|default).[a-zA-Z]{3,4}$/,'') .replace(/\/$/,''); } var locationPath = filterPath(location.pathname); var scrollElem = scrollableElement('html', 'body'); function refreshAnchors(){ $('a[href*=#]').each(function() { var thisPath = filterPath(this.pathname) || locationPath; if ( locationPath == thisPath && (location.hostname == this.hostname || !this.hostname) && this.hash.replace(/#/,'') ) { var $target = $(this.hash), target = this.hash; if (target && $target.offset()!=null) { var targetOffset = $target.offset().top; $(this).unbind("click"); $(this).click(function(event){ event.preventDefault(); $('html, body').animate({scrollTop: targetOffset}, 400, function() { location.hash = target; }); }); } } }); } // use the first element that is "scrollable" function scrollableElement(els) { for (var i = 0, argLength = arguments.length; i