/*jquery-scrollstop*/ !function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):"object"==typeof exports?module.exports=factory(require("jquery")):factory(jQuery)}(function($){var dispatch=$.event.dispatch||$.event.handle,special=$.event.special,uid1="D"+ +new Date,uid2="D"+(+new Date+1);special.scrollstart={setup:function(data){var timer,_data=$.extend({latency:special.scrollstop.latency},data),handler=function(evt){var _self=this,_args=arguments;timer?clearTimeout(timer):(evt.type="scrollstart",dispatch.apply(_self,_args)),timer=setTimeout(function(){timer=null},_data.latency)};$(this).bind("scroll",handler).data(uid1,handler)},teardown:function(){$(this).unbind("scroll",$(this).data(uid1))}},special.scrollstop={latency:250,setup:function(data){var timer,_data=$.extend({latency:special.scrollstop.latency},data),handler=function(evt){var _self=this,_args=arguments;timer&&clearTimeout(timer),timer=setTimeout(function(){timer=null,evt.type="scrollstop",dispatch.apply(_self,_args)},_data.latency)};$(this).bind("scroll",handler).data(uid2,handler)},teardown:function(){$(this).unbind("scroll",$(this).data(uid2))}}}); /* one-page scrolling ------------------------------------------------------------------------*/ window.o35 || (window.o35 = {}); o35.throttle = function(func, wait, options) { var context, args, result; var timeout = null; var previous = 0; options || (options = {}); var later = function() { previous = options.leading === false ? 0 : (new Date()).getTime(); timeout = null; result = func.apply(context, args); context = args = null; }; return function() { var now = (new Date()).getTime(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; }; o35.debounce = function(func, wait, immediate) { var timeout, args, context, timestamp, result; var later = function() { var last = (new Date()).getTime() - timestamp; if (last < wait) { timeout = setTimeout(later, wait - last); } else { timeout = null; if (!immediate) { result = func.apply(context, args); context = args = null; } } }; return function() { context = this; args = arguments; timestamp = (new Date()).getTime(); var callNow = immediate && !timeout; if (!timeout) { timeout = setTimeout(later, wait); } if (callNow) { result = func.apply(context, args); context = args = null; } return result; }; }; jQuery(document).ready(function($){ // Smooth Scroll for Menu $('.menu-header .page-scroll a').click(function () { // var target = this; // jQuery('.menu-header .page-scroll>a').removeClass('showing'); // jQuery(this).addClass('showing'); var link = this; var href = $(link).attr('href').split('#'); var Header_height = $('.navbar-custom').innerHeight(); if (href[1]) { var target = $('#' + href[1]); if (target.length > 0) { var posEle = target.offset().top - Header_height; $('html,body').animate({scrollTop: posEle}, 600); return false; } } }); function refreshUrlHash(id) { if (id && window.history && history.pushState) { var url = location.href, pos = url.indexOf('#'); if (-1 !== pos) { url = url.substr(0, pos); } url += '#' + id; history.replaceState({}, null, url); } } var refreshUrlHashDebounced = o35.debounce(refreshUrlHash, 200); function highlightVisibleSection() { var $node; $('.section').each(function () { var $section = $(this); if ($section.attr('id') && isScrolledIntoView($section)) { $node = $section; } }); if ($node && $node.length) { var id = $node.attr('id'); var target = $(".menu-header .page-scroll > a[href*='" + id + "']"); if (id && target.length > 0) { $('.menu-header .page-scroll > a').removeClass('showing'); target.addClass('showing'); refreshUrlHashDebounced(id); return false; } } } // Scroll after page load $(window).load(function () { var hash = window.location.hash; var target; var Header_height = $('.navbar-custom').innerHeight(); if (hash) { target = $(hash); if (target.length > 0) { var posEle = target.offset().top - Header_height; $('html,body').animate({scrollTop: posEle}, 600); return false; } } else { highlightVisibleSection(); } }); $('.navbar-custom').append('
'); $(window).on('scroll', o35.throttle(highlightVisibleSection, 200)); highlightVisibleSection(); }); function isScrolledIntoView(elem) { var $elem = jQuery(elem); var $window = jQuery(window); var $navbar = jQuery(".navbar-custom"); var docViewTop = $window.scrollTop(); var docViewBottom = docViewTop + $window.height(); var elemTop = $elem.offset().top-$navbar.innerHeight()-20; var elemBottom = elemTop + $elem.height(); return ((docViewTop >= elemTop)); } /* back to top, window resizing ------------------------------------------------------------------------*/ jQuery(document).ready(function($) { //back to top $(window).scroll(function(){ if($(window).scrollTop()>100){ if(!$('#back_to_top').hasClass('show')) $('#back_to_top').addClass('show'); if(!$('#back_to_top').hasClass('scroll')) $('#back_to_top').addClass('scroll'); } else $('#back_to_top').removeClass('show'); }); $(window).on('scrollstop',function(){ $('#back_to_top').removeClass('scroll'); }); if($(window).scrollTop()>100) $('#back_to_top').addClass('show'); else $('#back_to_top').removeClass('show'); $('#back_to_top').click(function(){ $('html,body').stop().animate({scrollTop:0},1000); return false; }); //window resizing, full screen banners $(window).resize(function(){ EventOnResize(); }); EventOnResize(); }); /* resizing elements ------------------------------------------------------------------------*/ function EventOnResize(){ var $wHieght = jQuery(window).height(); var $nhHieght = 0;//jQuery('.navbar-custom').height(); var $nnH = $wHieght-$nhHieght; jQuery('.image-banner.full-screen').css('height',$nnH+'px'); jQuery('.row').each(function(){ if(jQuery(this).find('.content-icon').length>0){ jQuery('.content-icon .title',this).css('min-height','inherit') jQuery('.content-icon .body',this).css('min-height','inherit') var titleH = 0; var bodyH = 0; jQuery('>div',this).each(function(){ var titleHn = jQuery('.content-icon .title',this).height(); var bodyHn = jQuery('.content-icon .body',this).height(); if(titleHn>titleH) titleH =titleHn; if(bodyHn>bodyH) bodyH =bodyHn; }); jQuery('.content-icon .title',this).css('min-height',titleH) jQuery('.content-icon .body',this).css('min-height',bodyH) } if(jQuery(this).find('.recent-entry').length>0){ jQuery('.recent-entry .recent-entry-title',this).css('min-height','inherit') jQuery('.recent-entry .recent-entry-content',this).css('min-height','inherit') var titleH = 0; var bodyH = 0; jQuery('>div',this).each(function(){ var titleHn = jQuery('.recent-entry .recent-entry-title',this).height(); var bodyHn = jQuery('.recent-entry .recent-entry-content',this).height(); if(titleHn>titleH) titleH =titleHn; if(bodyHn>bodyH) bodyH =bodyHn; }); jQuery('.recent-entry .recent-entry-title',this).css('min-height',titleH); jQuery('.recent-entry .recent-entry-content',this).css('min-height',bodyH+15); /* 15= recent-entry-content padding-bottom */ } }); } jQuery(document).ready(function($) { $('.frontpage-banner .btn').click(function(){ var link = this; var href = $(link).attr('href').split('#'); var Header_height = $('.navbar-custom').innerHeight(); if (href[1]) { var target = $('#' + href[1]); if (target.length > 0) { var posEle = target.offset().top - Header_height; $('html,body').stop().animate({scrollTop: posEle}, 600); return false; } } }); }); jQuery(document).ready(function($) { $('.navbar-collapse a').click(function(){ $('.navbar-collapse').removeClass('in'); }); }); // Sticky Header jQuery(document).ready(function($) { $(window).on("load scroll touchmove", function () { $('.navbar').toggleClass('sticky', $(document).scrollTop() > 90); }); var borderWidth = $("body").prop("clientWidth"); $('.one-side-border').css({ "border-right-width": borderWidth, "border-bottom-width": borderWidth / 15 }); $(window).on('resize', function(e) { var borderWidth = $(window).width(); $('.one-side-border').css({ "border-right-width": borderWidth, "border-bottom-width": borderWidth / 15 }); }); });