(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 0) { return el; } else { $scrollElement.scrollTop(1); var isScrollable = $scrollElement.scrollTop()> 0; $scrollElement.scrollTop(0); if (isScrollable) { return el; } } } return []; } var widthh; function getWidth(){ var winW = 630, winH = 460; if (document.body && document.body.offsetWidth) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) { winW = document.documentElement.offsetWidth; winH = document.documentElement.offsetHeight; } if (window.innerWidth && window.innerHeight) { winW = window.innerWidth; winH = window.innerHeight; } widthh=winW; } //the initialising function. accepts 2 divs and options function es_init(box1,box2, options){ var box1height = box1.height(), box2height = box2.height(), slowbox = "no box", fastbox = "no box"; slowbox = box2; fastbox = box1; var x = fastbox.height(), y = slowbox.height(), z = x-y, q = 0, m = fastbox.offset().top, c = $(window).height(), v=x-c; slowbox.parent().css('position','relative'); $(window).scroll(function(){ if (scroll_ok4 === true) { if(widthh>767){ q = $(window).scrollTop(); if(q>m){ marge=parseInt(z*(((q-m)/v))); if(marge<0){ marge = 0 } if(marge<=z){ slowbox.css('position','absolute'); slowbox.css('top',marge); slowbox.css('right',0); } }else{ slowbox.css('top',0); slowbox.css('position','relative'); } }else{ slowbox.css('top',0); slowbox.css('position','relative'); } scroll_ok4 = false; } }); } function es_init_left(box1,box2, options){ var box1height = box1.height(), box2height = box2.height(), slowbox = "no box", fastbox = "no box"; slowbox = box2; fastbox = box1; var x = fastbox.height(), y = slowbox.height(), z = x-y, q = 0, m = fastbox.offset().top, c = $(window).height(), v=x-c; $(window).scroll(function(){ if(widthh>767){ q = $(window).scrollTop(); if(q>m){ marge=parseInt(z*(((q-m)/v))); if(marge<0){ marge = 0 } if(marge<=z){ slowbox.css('padding-top',marge); } }else{ slowbox.css('padding-top',0); } }else{ slowbox.css('padding-top',0); } }); } })(jQuery);