1 line
2.4 KiB
JavaScript
Executable File
1 line
2.4 KiB
JavaScript
Executable File
var Layout=function(){var a=function(){$(window).scrollTop()>60?$("body").addClass("page-on-scroll"):$("body").removeClass("page-on-scroll")},b=function(){$(".navbar").offset().top>150&&$(".navbar-fixed-top").addClass("top-nav-collapse"),$(window).scroll(function(){$(".navbar").offset().top>150?$(".navbar-fixed-top").addClass("top-nav-collapse"):$(".navbar-fixed-top").removeClass("top-nav-collapse")});var a=0;a=$(".navbar-fixed-top").height()-20,$(".js_nav-item a").bind("click",function(b){var c=$($(this).attr("href")).offset().top;$("html, body").stop().animate({scrollTop:c-a},600),b.preventDefault()}),$("body").scrollspy({target:".navbar-fixed-top",offset:a+2}),$(window).scroll(function(){$(".navbar-collapse.in").collapse("hide")})},c=function(){var a=$(".carousel .item"),b=$(window).height();a.eq(0).addClass("active"),a.height(b),a.addClass("full-screen"),$(".carousel img").each(function(){var a=$(this).attr("src"),b=$(this).attr("data-color");$(this).parent().css({"background-image":"url("+a+")","background-color":b}),$(this).remove()}),$(window).on("resize",function(){b=$(window).height(),a.height(b)})},d=function(){$("[data-auto-height]").each(function(){var a=$(this),b=$("[data-height]",a),c=0,e=a.attr("data-mode"),d=parseInt(a.attr("data-offset")?a.attr("data-offset"):0);b.each(function(){"height"==$(this).attr("data-height")?$(this).css("height",""):$(this).css("min-height","");var a="base-height"==e?$(this).outerHeight():$(this).outerHeight(!0);a>c&&(c=a)}),c+=d,b.each(function(){"height"==$(this).attr("data-height")?$(this).css("height",c):$(this).css("min-height",c)}),a.attr("data-related")&&$(a.attr("data-related")).css("height",a.height())})},e=function(){var a=$(".work-popup-overlay"),b=$(".work-popup-close"),c=$(".work-popup-trigger");$(".work-popup-content"),c.on("click",function(){$(this).find(".work-popup-overlay").removeClass("work-popup-overlay-show"),$(this).find(".work-popup-overlay").addClass("work-popup-overlay-show")}),b.on("click",function(b){b.stopPropagation(),a.removeClass("work-popup-overlay-show")}),a.on("click",function(b){b.stopPropagation(),a.removeClass("work-popup-overlay-show")})};return{init:function(){a(),b(),c(),d(),e(),$(window).scroll(function(){a()})},getViewPort:function(){var a=window,b="inner";return"innerWidth"in window||(b="client",a=document.documentElement||document.body),{width:a[b+"Width"],height:a[b+"Height"]}}}}();$(document).ready(function(){Layout.init()}) |