blob: bf971112ede597e3cedcfb6dafd3e78302babdcb [file] [log] [blame]
$(document).ready(function(){function e(e){var t=e.classNameMenu,n={DESKTOP_BREAKPOINT:1024};return{idMenu:t,menuConfig:{},bindEvents:function(){var e=this;$(window).scroll(function(){if($(window).width()>n.DESKTOP_BREAKPOINT){var o=$(window).scrollTop(),a=o+$("."+t).height()+e.menuConfig.offsetTop,r=o+$(window).height(),i=$("body")[0].scrollHeight-e.menuConfig.offsetBottom;o<=e.menuConfig.offsetTop?$("."+t).css({top:"",bottom:""}):o>e.menuConfig.offsetTop&&a<i?$("."+t).css({top:e.menuConfig.offsetTop,bottom:""}):a>=i&&$("."+t).css({top:"",bottom:r-i})}else $("."+t).css({top:"",bottom:""})}),$(window).resize(function(){$(window).width()<=n.DESKTOP_BREAKPOINT&&$("."+t).css({top:"",bottom:""})})},isMenuPresent:function(){return $("."+t).length>0},init:function(){this.isMenuPresent()&&(this.menuConfig=$("."+this.idMenu).data(),this.bindEvents())}}}e({classNameMenu:"page-nav"}).init()})