(function($) { 'use strict'; $(document).ready(function($) { var windowWidth = $(window).width(); var viewportHeigh = $(window).outerHeight(); $("#capital-main, #capitalVideoWrapper").fitVids(); var realFooterWrapper = $('#capitalFooterWrapper'), realFooterHeight = $('#capitalFooterWrapper > div').outerHeight(), fakeFooter = $('#capitalFooterFake'); if (realFooterHeight > viewportHeigh) { realFooterWrapper.addClass('capitalStatic'); fakeFooter.hide(); } else { realFooterWrapper.addClass('capitalFixed'); fakeFooter.height(viewportHeigh + 15); realFooterWrapper.height(fakeFooter); } function fix_page_banner_height() { if ($('.capitalHeader').length != 0) { $('#capitalRgba').css('padding-top', 0); $('#capitalTitle, #capitalRgba').height($(window).height()); } } fix_page_banner_height(); $(window).resize(function() { fix_page_banner_height(); }); var $window = $(window); var windowHeight = $window.height(); $window.resize(function() { windowHeight = $window.height(); }); $('#capitalToTop').click(function(e) { e.preventDefault(); if ($('#capitalFullPageWrap').length > 0) { $.fn.fullpage.moveToFirst(); } else { $("html, body").animate({ scrollTop: 0 }, 450); } }); $('.topNavGoTo').click(function(e) { e.preventDefault(); if ($('#capitalFullPageWrap').length > 0) { $.fn.fullpage.moveTo($(this).data('index')); } else { $("html, body").animate({ scrollTop: 0 }, 450); } }); $('#searchModal').on('show.bs.modal', function (event) { setTimeout(function(){ //If modal has class $('#searchInput').focus(); },1000); }); $("#searchForm").submit(function(e) { $.ajax({ url: '/search.php', data: $('#searchForm').serialize(),// + '&action=send', type: 'post', cache: false, dataType: 'html', success: function (data) { $('#searchResults').html(data); }, error: function (data) {alert('An error occurred.');} }); e.preventDefault(); }); }); //ANIMATE EFFECTS if ($(window).width() > 768) { $(".tofade, .tozoom").css("opacity", 0); $(".tofade").waypoint(function (g) { if (g == "down" && custom_fp_active==0) { $(this.element).addClass("animated fadeInUp"); } },{offset: '95%'}); $(".tozoom").waypoint(function (g) { if (g == "down" && custom_fp_active==0) { $(this.element).addClass("animated zoomIn"); $(this.element).css("opacity", 1); } },{ offset: '95%' }); //'bottom-in-view' } //ACCEPT COOKIES $("#accept-cookies").click(function () { $("#cookie-message").hide(); $("#CookieForm").action = '/index.php?cookies=1'; $("#CookieForm").submit(); }); $("#refuse-cookies").click(function () { //$("#cookie-message").hide(); //$("#CookieForm").attr('action', '/index.php?cookies=-1'); //$("#CookieForm").submit(); }); //IE-SCROLL-FIX if(navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) { $('body').on("mousewheel", function () { event.preventDefault(); var wd = event.wheelDelta; var csp = window.pageYOffset; window.scrollTo(0, csp - wd); }); } }(jQuery))