Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fixes srcset in sticky menu logo
jQuery(document).ready(function(g){var n=g(window),e=n.width(),q=g("body"),s=g("#branding"),j=g(".tb-primary-menu");if(e<768){q.addClass("mobile-on");q.removeClass("tablet-on");if(s.hasClass("transparent")){s.removeClass("transparent");s.addClass("transparent-off")}}else{if(e<992){q.addClass("tablet-on");q.removeClass("mobile-on")}}n.on("resize",function(){var t=n.width();if(t<768){q.addClass("mobile-on");q.removeClass("tablet-on");if(s.hasClass("transparent")){s.removeClass("transparent");s.addClass("transparent-off")}}else{if(t<992){q.addClass("tablet-on");q.removeClass("mobile-on");if(s.hasClass("transparent-off")){s.removeClass("transparent-off");s.addClass("transparent")}}else{q.removeClass("tablet-on");q.removeClass("mobile-on");if(s.hasClass("transparent-off")){s.removeClass("transparent-off");s.addClass("transparent")}}}});if(themeblvd.mobile_side_menu=="true"&&j.hasClass("tb-to-mobile-menu")){q.addClass("mobile-menu-"+themeblvd.mobile_menu_location+"-off");g("#wrapper").after('<div class="tb-mobile-menu-wrapper '+themeblvd.mobile_menu_location+'"><div class="wrap"></div></div>');var m=g(".tb-mobile-menu-wrapper > .wrap"),d=g("#primary-menu-open"),h=g("#primary-menu-close"),k=g(".tb-to-mobile-menu"),r=parseInt(themeblvd.mobile_menu_viewport_max);s.find(".tb-search").first().clone().addClass("mini").appendTo(m);j.clone().appendTo(m);q.find(".header-text.to-mobile").first().clone().appendTo(m);q.find(".tb-social-icons.to-mobile").first().clone().appendTo(m);m.find("li.menu-search, li.menu-contact, li.menu-cart").remove();m.find(".tb-primary-menu").removeClass("sf-menu tb-primary-menu").addClass("tb-mobile-menu tb-side-menu");if(!s.find(".menu-item-language").length){s.find(".top-wpml").each(function(){var u=g(this),t=g('<li class="menu-item mobile-wpml"></li>'),w=g('<span class="menu-btn">'+u.find(".tb-wpml-switcher > ul > li > a").html()+"</span>"),v=u.find(".lang-sub-menu");t.append(w);if(v.length){w.find(".fa").addClass("sf-sub-indicator");t.append(v.clone().addClass("sub-menu non-mega-sub-menu"))}t.appendTo(m.find(".tb-mobile-menu"))})}if(themeblvd.mobile_side_menu_icon_color){m.find(".tb-social-icons").removeClass("grey dark light flat color").addClass(themeblvd.mobile_side_menu_icon_color).find(".social-media > li > a").each(function(){if(themeblvd.mobile_side_menu_icon_color=="color"){g(this).removeClass("tb-icon")}else{g(this).addClass("tb-icon")}})}d.on("click",function(){q.removeClass("mobile-menu-"+themeblvd.mobile_menu_location+"-off").addClass("mobile-menu-"+themeblvd.mobile_menu_location+"-on");d.hide();h.show();return false});h.on("click",function(){q.removeClass("mobile-menu-"+themeblvd.mobile_menu_location+"-on").addClass("mobile-menu-"+themeblvd.mobile_menu_location+"-off");h.hide();d.show();return false});g("#wrapper").on("click",function(){q.removeClass("mobile-menu-"+themeblvd.mobile_menu_location+"-on").addClass("mobile-menu-"+themeblvd.mobile_menu_location+"-off");h.hide();d.show()});n.on("resize",function(){if(n.width()>r){q.removeClass("mobile-menu-"+themeblvd.mobile_menu_location+"-on").addClass("mobile-menu-"+themeblvd.mobile_menu_location+"-off");h.hide();d.show()}})}g(".tb-side-menu").on("click",".tb-side-menu-toggle",function(){var t=g(this);if(t.hasClass("open")){t.next(".sub-menu, .sf-mega").slideUp(100);t.removeClass("open fa-"+t.data("close"));t.addClass("fa-"+t.data("open"))}else{t.next(".sub-menu, .sf-mega").slideDown(100);t.removeClass("fa-"+t.data("open"));t.addClass("open fa-"+t.data("close"))}});if(themeblvd.sticky!=="false"){var a=g(themeblvd.sticky),c=g('<div id="sticky-menu" class="tb-sticky-menu"><div class="wrap sticky-wrap clearfix"><div class="nav"></div></div></div>').appendTo(a);s.find(".header-logo:first-child").clone().appendTo(c.find(".sticky-wrap"));if(themeblvd.sticky_logo){c.find(".header_logo_image img").attr("src",themeblvd.sticky_logo).removeAttr("width height srcset")}j.clone().appendTo(c.find(".sticky-wrap > .nav"));if(c.find(".tb-primary-menu li.menu-contact").length){c.find(".tb-contact-trigger").data("container",".tb-sticky-menu")}else{if(s.find(".tb-social-icons").length){c.find(".tb-primary-menu").append('<li class="menu-item level-1 menu-contact"><a href="#" class="tb-contact-trigger menu-btn" tabindex="0" data-toggle="popover" data-container=".tb-sticky-menu" data-placement="bottom" data-open="envelope-o" data-close="close"><i class="fa fa-envelope-o"></i></a></li>');s.find(".tb-social-icons").first().clone().appendTo(c.find(".menu-contact")).wrap('<div class="contact-popover-content hide"></div>')}}if(c.find(".tb-social-icons").hasClass("light")){c.find(".tb-social-icons").removeClass("light").addClass("grey")}if(s.find(".tb-cart-trigger").length&&!c.find(".tb-primary-menu li.menu-cart").length){s.find(".tb-cart-trigger").first().clone().appendTo(c.find(".tb-primary-menu")).wrap('<li class="menu-item level-1 menu-cart"></li>')}if(c.find(".tb-primary-menu li.menu-search").length){c.find(".tb-search-trigger").data("placement","below").addClass("menu-btn");s.find(".tb-floating-search").clone().appendTo(c)}else{if(s.find(".tb-search-trigger").length){s.find(".tb-floating-search").clone().appendTo(c);s.find(".tb-search-trigger").first().clone().appendTo(c.find(".tb-primary-menu")).wrap('<li class="menu-item level-1 menu-search"></li>');c.find(".tb-search-trigger").data("placement","below").addClass("menu-btn")}}a.viewportChecker({classToAdd:"visible",repeat:true,offset:parseInt(themeblvd.sticky_offset),callbackFunction:function(t,u){if(t.hasClass("visible")){var v=t.find("#sticky-menu .tb-search-trigger");if(v.hasClass("open")){v.stop().removeClass("open").html('<i class="fa fa-'+v.data("open")+'"></i>');t.find("#sticky-menu .tb-floating-search").fadeOut(250).attr("style","").removeClass("below")}t.find("#sticky-menu .tb-contact-trigger").popover("hide");t.find("#sticky-menu .menu-item").each(function(){var w=g(this).closest("li");if(w.hasClass("sfHover")){w.removeClass("sfHover");w.find(".non-mega-sub-menu").hide();w.find(".sf-mega").hide()}})}}})}if(themeblvd.superfish=="true"){g("ul.sf-menu").superfish({speed:200,popUpSelector:".non-mega-sub-menu,.sf-mega",onBeforeShow:function(){var u=g(this),w=u.closest("li"),t=w.offset(),v=200;if(!u.hasClass("non-mega-sub-menu")||!w.hasClass("level-1")){return}if(u.find(".level-4").length>0){v=600}else{if(u.find(".level-3").length>0){v=400}}if((g(window).width()-t.left)<=v){u.addClass("reverse");u.find(".fa-caret-right, .fa-caret-left").each(function(){g(this).addClass("inverse")})}else{u.removeClass("reverse");u.find(".fa-caret-right, .fa-caret-left").each(function(){g(this).removeClass("inverse")})}}});g(".tb-mobile-menu").superfish({speed:200,popUpSelector:".non-mega-sub-menu,.sf-mega"})}g("ul.sf-menu li.no-click, ul.tb-mobile-menu li.no-click").find("a:first").on("click",function(){return false});g("a.no-click").on("click",function(){return false});g(".tb-search-trigger").on("click",function(){var v=g(this),u=v.data("placement"),w=v.closest(".site-header > .wrap, .tb-sticky-menu").find(".tb-floating-search"),t=w.closest(".site-header");w.removeClass("full bottom below top").addClass(u);if(v.hasClass("open")){v.stop().removeClass("open").html('<i class="fa fa-'+v.data("open")+'"></i>');w.stop().fadeOut(250,function(){g(this).attr("style","")});if(t.find(".header-content > .wrap").hasClass("floating-search-full-on")){t.find(".header-content > .wrap").stop().animate({opacity:1},250).removeClass("floating-search-full-on")}else{if(t.find(".header-nav").hasClass("floating-search-below-on")){t.find(".header-nav").stop().animate({opacity:1},250).removeClass("floating-search-below-on")}}}else{v.stop().addClass("open").html('<i class="fa fa-'+v.data("close")+'"></i>');if(u=="full"){w.fadeIn(250).find(".search-input").focus();t.find(".header-content > .wrap").stop().animate({opacity:0},250).addClass("floating-search-full-on")}else{if(u=="bottom"){w.stop().css({bottom:-5,marginTop:0,display:"block",opacity:0}).animate({bottom:0,opacity:1},250).find(".search-input").focus()}else{if(u=="below"){w.stop().css({top:"100%",marginTop:-5,display:"block",opacity:0}).animate({marginTop:0,opacity:1},250).find(".search-input").focus();g(".site-header > .wrap > .header-nav").stop().animate({opacity:0.1},250).addClass("floating-search-below-on")}else{w.stop().css({top:-5,marginTop:0,display:"block",opacity:0}).animate({top:0,opacity:1},250).find(".search-input").focus()}}}}return false});n.on("load",function(){g(".tb-isotope").each(function(){var v=g(this),u="fitRows",t=true;if(v.hasClass("tb-masonry")){u="masonry"}if(q.hasClass("rtl")){t=false}v.find(".post-wrap > .row").fadeIn(400,function(){var w=v.find(".post-wrap > .row").isotope({layoutMode:u,itemSelector:".iso-item",filter:"*",isOriginLeft:t});v.find(".tb-loader").fadeOut(100);if(v.hasClass("tb-filter")){v.find(".tb-filter-nav").fadeIn(400);v.find(".filter-menu > li > a").on("click",function(){var y=g(this),x=y.data("filter");v.find(".filter-menu > li").removeClass("active");y.closest("li").addClass("active");w.isotope({filter:x});y.closest(".tb-filter").find(".grid-item").each(function(){var z=g(this);if(z.is(x)){z.find("a.lightbox-gallery-item").addClass("visible")}else{z.find("a.lightbox-gallery-item").removeClass("visible")}});return false})}})})});g(".tb-contact-trigger").popover({html:true,template:'<div class="tb-contact-popover popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',content:function(){return g(this).next(".contact-popover-content").html()}}).on("click",function(t){t.preventDefault()});g(".tb-contact-trigger").on("show.bs.popover",function(){var t=g(this);t.html('<i class="fa fa-'+t.data("close")+'"></i>')});g(".tb-contact-trigger").on("hide.bs.popover",function(){var t=g(this);t.html('<i class="fa fa-'+t.data("open")+'"></i>')});if(themeblvd.scroll_to_top=="true"){var l=g(".tb-scroll-to-top");n.on("scroll",function(){if(g(this).scrollTop()>400){l.fadeIn()}else{l.fadeOut()}});l.on("click",function(){g("html, body").animate({scrollTop:0},400);return false})}g(".tb-scroll-to-section").on("click",function(){var t=g(this),v=null,u=0;if(this.hash&&this.hash!="#"){v=this.hash}else{v="#"+t.closest(".element-section").next().attr("id")}u=g(v).offset().top;if(themeblvd.sticky!=="false"){u=u-48}g("html, body").animate({scrollTop:u},800);return false});g(".tb-share .btn-share.popup").on("click",function(){if(!window.open(g(this).attr("href"),"","height=320, width=640, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no")){document.location.href=g(this).attr("href")}return false});if(themeblvd.gallery=="true"){g(".gallery").each(function(){var t=g(this);t.addClass("themeblvd-gallery clearfix");t.find(".gallery-item a").each(function(){var u=this.href.split("?"),u=u[0],v="tb-thumb-link";if(themeblvd.gallery_thumb_frame=="true"){v+=" thumbnail"}if(u.match(/\.(jpe?g|png|bmp|gif|tiff?)$/i)){v+=" image";if(themeblvd.magnific_popup=="true"){v+=" lightbox-gallery-item mfp-image image-button visible"}}else{v+=" post"}g(this).addClass(v)})})}if(themeblvd.magnific_popup=="true"){var i=0,f="";if(themeblvd.lightbox_animation!="none"){i=160;f="themeblvd-mfp-"+themeblvd.lightbox_animation}g(".themeblvd-gallery").each(function(){g(this).find(".themeblvd-lightbox").each(function(){g(this).removeClass("themeblvd-lightbox").addClass("lightbox-gallery-item visible")});g(this).magnificPopup({disableOn:themeblvd.lightbox_mobile_gallery,delegate:"a.lightbox-gallery-item.visible",gallery:{enabled:true},image:{cursor:null,},iframe:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></div>'},removalDelay:i,mainClass:f})});g(".themeblvd-lightbox").magnificPopup({disableOn:themeblvd.lightbox_mobile,removalDelay:i,mainClass:f,image:{cursor:null,}});g(".themeblvd-lightbox.lightbox-iframe, li.menu-item.video > a").magnificPopup({disableOn:themeblvd.lightbox_mobile_iframe,type:"iframe",removalDelay:i,mainClass:f});g.extend(true,g.magnificPopup.defaults,{tClose:themeblvd.lightbox_close,tLoading:themeblvd.lightbox_loading,gallery:{tPrev:themeblvd.lightbox_previous,tNext:themeblvd.lightbox_next,tCounter:themeblvd.lightbox_counter},image:{tError:themeblvd.lightbox_error},ajax:{tError:themeblvd.lightbox_error}})}g(".tb-jump-menu").change(function(){window.location.href=g(this).val()});g(".tb-block-slider").each(function(){var y=g(this),z=y.find(".slider-inner"),x=y.data("fx"),w=y.data("timeout"),B=true,t=y.data("nav"),A=false,u=false,v=false;if(q.hasClass("mobile")){x="slide"}if(w&&w!=="0"&&!q.hasClass("mobile")){w=w+"000"}else{B=false}if(t&&t!=="0"){t=true}else{t=false}if(!t){A=true}n.on("load",function(){z.flexslider({smoothHeight:u,animation:x,easing:"swing",slideshowSpeed:w,animationSpeed:"1000",slideshow:B,directionNav:false,controlNav:v,pauseOnHover:A,pauseOnAction:false,start:function(C){if(!q.hasClass("mobile")){y.find(".tb-slider-arrows").fadeIn(100)}y.find(".tb-loader").fadeOut(100)}})});if(t){z.on("mouseover",function(){z.data("flexslider").flexslider("pause")});y.find(".slider-inner > .tb-slider-arrows a").on("click",function(){if(g(this).hasClass("next")){z.data("flexslider").flexslider("next")}else{z.data("flexslider").flexslider("prev")}z.data("flexslider").flexslider("pause");return false})}});g(".tb-jumbotron-slider").each(function(){var t=g(this);t.on("slide.bs.carousel",function(v){var u=g(v.relatedTarget).find(".jumbotron-outer").outerHeight();t.animate({height:u},1000);if(!q.hasClass("mobile")){t.addClass("animate");setTimeout(function(){t.removeClass("animate")},1000)}});t.find(".tb-slider-arrows a, .carousel-indicators li").on("click",function(){t.carousel("pause")});n.on("load",function(){t.find(".carousel-control-wrap").fadeIn(200,function(){var u=t.find(".item.active .jumbotron-outer").outerHeight();t.animate({height:u});t.find(".tb-loader").fadeOut(100)})})});n.on("resize",function(){g(".tb-jumbotron-slider").each(function(){var u=g(this),t=u.find(".item.active .jumbotron-outer").outerHeight();u.css("height",t)})});var p=g(".tb-parallax .parallax-figure");n.on("load",function(){p.each(function(){var E=g(this),t=E.find("img, .img");if(n.width()>991&&n.height()>499){var w=t.height(),x=(E.height()>0)?E.height():500,A=w-x,u=E.offset().top+x,C=E.offset().top,B=n.scrollTop(),D=window.innerHeight,v=B+D,z=(v-C)/(x+D),y=Math.round((A*z));if((u>B)&&(C<(B+D))){t.css("transform","translate3D(-50%,"+y+"px, 0)")}}t.addClass("on")})});n.on("scroll resize",function(){if(n.width()<992||n.height()<500){return}p.each(function(){var E=g(this),t=E.find("img, .img"),w=t.height(),x=(E.height()>0)?E.height():500,A=w-x,u=E.offset().top+x,C=E.offset().top,B=n.scrollTop(),D=window.innerHeight,v=B+D,z=(v-C)/(x+D),y=Math.round((A*z));if((u>B)&&(C<(B+D))){t.css("transform","translate3D(-50%,"+y+"px, 0)")}})});if(themeblvd.custom_buttons=="true"){g(".tb-custom-button").hover(function(){var t=g(this);t.css({"background-color":t.data("bg-hover"),color:t.data("text-hover")})},function(){var t=g(this);t.css({"background-color":t.data("bg"),color:t.data("text")})})}if(typeof google==="object"&&typeof google.maps==="object"){g(".tb-map").each(function(){var u=g(this);var t=function(){var v=u.find(".map-canvas").attr("id"),x,A;x={center:new google.maps.LatLng(u.find(".map-center").data("lat"),u.find(".map-center").data("long")),zoom:u.data("zoom"),draggable:u.data("draggable"),panControl:u.data("pan_control"),zoomControl:u.data("zoom_control"),mapMaker:false,mapTypeControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP,backgroundColor:"transparent",streetViewControl:false,scrollwheel:false};A=new google.maps.Map(document.getElementById(v),x);u.find(".map-marker").each(function(){var D=g(this),C=null;if(D.data("image")){C={url:D.data("image")};if(D.data("image-width")&&D.data("image-height")){C.scaledSize=new google.maps.Size(parseInt(D.data("image-width")),parseInt(D.data("image-height")))}}var B=new google.maps.Marker({position:new google.maps.LatLng(D.data("lat"),D.data("long")),map:A,title:D.data("name"),icon:C,animation:google.maps.Animation.DROP});var E=new google.maps.InfoWindow({content:'<div class="map-marker-info">'+D.find(".map-marker-info").html()+"</div>"});google.maps.event.addListener(B,"click",function(){E.open(A,B)})});var w=[],y=[],z;w.push({saturation:u.data("saturation")});w.push({lightness:u.data("lightness")});if(u.data("hue")){w.push({hue:u.data("hue")})}if(w.length){y=[{featureType:"all",elementType:"all",stylers:w}];z=new google.maps.StyledMapType(y,{name:"tb_map_style"});A.mapTypes.set("tb_map_style",z);A.setMapTypeId("tb_map_style")}};google.maps.event.addDomListener(window,"load",t)})}if(themeblvd.bootstrap=="true"){g("#calendar_wrap table").addClass("table table-bordered");g(".tabbable.fixed-height").each(function(){var t=0;g(this).find(".tab-pane").each(function(){var u=g(this).height();if(u>t){t=u}});g(this).find(".tab-pane").height(t)});g(".collapse").on("show.bs.collapse",function(){g(this).closest(".panel").find(".panel-heading a").addClass("active-trigger").find(".switch-me").removeClass("fa-plus-circle").addClass("fa-minus-circle")});g(".collapse").on("hide.bs.collapse",function(){g(this).closest(".panel").find(".panel-heading a").removeClass("active-trigger").find(".switch-me").removeClass("fa-minus-circle").addClass("fa-plus-circle")});var o;g(".tb-accordion").each(function(){o=g(this).attr("id");g(this).find(".panel-heading a").each(function(){g(this).attr("data-parent","#"+o)})});g(".tb-simple-slider .carousel-thumb-nav li").click(function(){var t=g(this);t.closest(".carousel-thumb-nav").find("li").removeClass("active");t.addClass("active")});g(".tb-simple-slider").on("slid.bs.carousel",function(){var t=g(this),u=t.data("bs.carousel"),v=u.getItemIndex(u.$element.find(".item.active"))+1;t.find(".carousel-thumb-nav li").removeClass("active");t.find(".carousel-thumb-nav li:nth-child("+v+")").addClass("active")});g(".tb-simple-slider .carousel-indicators").each(function(){var t=g(this),u=(14*t.find("li").length);t.css({width:u+"px","margin-left":"-"+(u/2)+"px"})});g(".tb-simple-slider").each(function(){var t=g(this);t.find(".tb-thumb-link, .carousel-indicators li, .carousel-control, .tb-slider-arrows > li > a").on("click",function(){t.carousel("pause")})});if(g.mobile){g('[data-ride="carousel"]').swiperight(function(){if(q.hasClass("rtl")){g(this).carousel("next")}else{g(this).carousel("prev")}});g('[data-ride="carousel"]').swipeleft(function(){if(q.hasClass("rtl")){g(this).carousel("prev")}else{g(this).carousel("next")}})}if(themeblvd.tabs_deep_linking=="true"){var b=document.location.hash;if(b&&b.indexOf("tab_")!=-1){g('.element-tabs a[href="'+b.replace("tab_","")+'"]').tab("show")}}g(".desktop .tb-tooltip").tooltip()}if(g.fn.easyPieChart!="undefined"){if(!q.hasClass("tb-scroll-effects")||q.hasClass("mobile")){g(".tb-milestone-percent").each(function(){var t=g(this).find(".chart");t.easyPieChart({lineWidth:10,size:140,animate:1000,barColor:t.data("color"),trackColor:t.data("track-color"),scaleColor:false,lineCap:"square",easing:"easeOutBounce"})})}}if(typeof Chart!=="undefined"){g(".tb-chart.pie, .tb-chart.doughnut").each(function(){var u=g(this),w="pie",t=u.find("canvas").get(0).getContext("2d"),x=[],v;if(u.hasClass("doughnut")){w="doughnut"}u.find(".data").each(function(){var y=g(this);x.push({value:y.data("value"),color:y.data("color"),highlight:y.data("highlight"),label:y.data("label")})});if(w=="doughnut"){v=new Chart(t).Doughnut(x,{showTooltips:u.data("tooltips")})}else{v=new Chart(t).Pie(x,{showTooltips:u.data("tooltips")})}if(u.data("legend")){u.append('<div class="legend">'+v.generateLegend()+"</div>")}if(q.hasClass("tb-scroll-effects")&&q.hasClass("desktop")){u.find(".chart-wrap").css("opacity","0").viewportChecker({classToAdd:"visible",offset:0,callbackFunction:function(y,z){y.css("opacity","1");v.render()}})}});g(".tb-chart.bar, .tb-chart.line").each(function(){var u=g(this),x="line",t=u.find("canvas").get(0).getContext("2d"),y=[],w=[],v;if(u.hasClass("bar")){x="bar"}u.find(".data").each(function(){var z=g(this);w.push({label:z.data("label"),fillColor:z.data("fill"),strokeColor:z.data("stroke"),pointColor:z.data("point"),data:z.data("values").split(",")})});y={labels:u.data("labels").split(","),datasets:w};if(x=="bar"){v=new Chart(t).Bar(y,{barShowStroke:false,scaleBeginAtZero:u.data("start"),showTooltips:u.data("tooltips")})}else{v=new Chart(t).Line(y,{bezierCurve:u.data("curve"),datasetFill:u.data("fill"),pointDot:u.data("dot"),scaleBeginAtZero:u.data("start"),showTooltips:u.data("tooltips")})}if(u.data("legend")){u.append('<div class="legend">'+v.generateLegend()+"</div>")}if(q.hasClass("tb-scroll-effects")&&q.hasClass("desktop")){u.find(".chart-wrap").css("opacity","0").viewportChecker({classToAdd:"visible",offset:0,callbackFunction:function(z,A){z.css("opacity","1");v.render()}})}})}if(q.hasClass("tb-scroll-effects")){g("#custom-main").find(".element-section, .element-section > .element").viewportChecker({classToAdd:"visible",offset:0})}g(".desktop.tb-scroll-effects .tb-milestone .milestone").each(function(){var u=g(this),t=parseInt(u.data("num"));u.viewportChecker({classToAdd:"visible",offset:0,callbackFunction:function(v,w){v.find(".num").countTo({from:0,to:t,speed:900,refreshInterval:30})}})});if(g.fn.easyPieChart!="undefined"){g(".desktop.tb-scroll-effects .tb-milestone-percent").each(function(){var t=g(this).find(".chart");t.css("opacity","0").viewportChecker({classToAdd:"visible",offset:0,callbackFunction:function(u,v){u.easyPieChart({lineWidth:10,size:140,animate:1000,barColor:t.data("color"),trackColor:t.data("track-color"),scaleColor:false,lineCap:"square",easing:"easeOutBounce",onStart:function(){t.css("opacity","1")}})}})})}g(".desktop.tb-scroll-effects .tb-progress .progress-bar").each(function(){g(this).viewportChecker({classToAdd:"visible",offset:0,callbackFunction:function(t,u){t.animate({width:t.data("percent")+"%"},400)}})})});(function(a){a.fn.viewportChecker=function(b){var d={classToAdd:"visible",offset:100,repeat:false,callbackFunction:function(g,h){}};a.extend(d,b);var c=this,f=a(window).height(),e=((navigator.userAgent.toLowerCase().indexOf("webkit")!=-1)?"body":"html");this.checkElements=function(){var g=a(e).scrollTop(),h=(g+f);c.each(function(){var k=a(this);if(k.hasClass(d.classToAdd)&&!d.repeat){return}var i=Math.round(k.offset().top)+d.offset,j=i+(k.height());if((i<h)&&(j>g)){k.addClass(d.classToAdd);d.callbackFunction(k,"add")}else{if(k.hasClass(d.classToAdd)&&(d.repeat)){k.removeClass(d.classToAdd);d.callbackFunction(k,"remove")}}})};a(window).bind("load scroll touchmove",this.checkElements);a(window).on("resize",function(g){f=g.currentTarget.innerHeight});return this}})(jQuery);(function(b){b.fn.countTo=function(c){c=c||{};return b(this).each(function(){var e=b.extend({},b.fn.countTo.defaults,{from:b(this).data("from"),to:b(this).data("to"),speed:b(this).data("speed"),refreshInterval:b(this).data("refresh-interval"),decimals:b(this).data("decimals")},c);var j=Math.ceil(e.speed/e.refreshInterval),k=(e.to-e.from)/j;var l=this,h=b(this),g=0,i=e.from,f=h.data("countTo")||{};h.data("countTo",f);if(f.interval){clearInterval(f.interval)}f.interval=setInterval(m,e.refreshInterval);d(i);function m(){i+=k;g++;d(i);if(typeof(e.onUpdate)=="function"){e.onUpdate.call(l,i)}if(g>=j){h.removeData("countTo");clearInterval(f.interval);i=e.to;if(typeof(e.onComplete)=="function"){e.onComplete.call(l,i)}}}function d(o){var n=e.formatter.call(l,o,e);h.text(n)}})};b.fn.countTo.defaults={from:0,to:0,speed:1000,refreshInterval:100,decimals:0,formatter:a,onUpdate:null,onComplete:null};function a(d,c){return d.toFixed(c.decimals)}}(jQuery));(function(a){a.fn.toggleMenu=function(b){var c=a.extend({viewport:768,openClass:"mobile-open",closedClass:"mobile-closed"},b);this.each(function(){var e=a(this),d,g,f=false;if(e.data("toggle")){d=a(e.data("toggle"))}else{d=a(e.attr("href"))}e.click(function(){if(d.hasClass(c.openClass)){d.slideUp().removeClass(c.openClass).addClass(c.closedClass)}else{d.slideDown().removeClass(c.closedClass).addClass(c.openClass)}return false});a(window).on("resize",function(){if(false!==f){clearTimeout(f)}f=setTimeout(function(){g=a(window).width();if(g>c.viewport){d.show().removeClass(c.openClass+" "+c.closedClass).addClass("expanded")}else{if(d.hasClass("expanded")){d.hide().removeClass("expanded")}}},100)})})}})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment