jQuery.noConflict(); jQuery(document).ready(function($){ var site = "https://www.gowr.co.uk"; /* generic controls */ $('img').addClass('responsive-image'); $('table').addClass('table'); /* hide some page elements */ $('.logoSm').hide(); $('nav').hide(); /* page nav bar control */ $(".open-panel").click(function(){ $('nav').show(); $("html").addClass("openNav"); }); $(".close-panel, #content").click(function(){ $("html").removeClass("openNav"); $('nav').fadeOut(250); }); /* carousel turn speed control */ $('.carousel').carousel({ interval : 6000 }) /* page waypoint control */ $('.wp1').waypoint(function() { $('.wp1').addClass('animated fadeInDown'); }, { offset: '1900' }); $('.wp2').waypoint(function() { $('.wp2').addClass('animated fadeIn'); }, { offset: '900' }); $('.wp3').waypoint(function() { $('.wp3').addClass('animated fadeIn'); }, { offset: '900' }); /* page scoll controls */ $(document).scroll(function(){ if($(this).scrollTop() > 184){ $('.carousel-inner').addClass('scrolled') $('.navBarHolder').addClass('fixed') }else{ $('.carousel-inner').removeClass('scrolled') $('.navBarHolder').removeClass('fixed') } }); /* top of page control */ $(document).scroll(function(){ if($(this).scrollTop() > 100){ $('#toTop').fadeIn(250); }else{ $('#toTop').fadeOut(250); } }); $("#toTop").click(function (e) { e.preventDefault(); var dest = 0; $('html,body').stop().animate({ scrollTop: dest }, 500, 'swing'); }); /* image gallery control */ $(".fancybox").fancybox({ padding: 0, openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', closeSpeed : 150, closeClick : true }); /* page transitions */ $(".slideIn,.paddedL,.paddedR").appear(); $(document.body).on("appear",".slideIn",function(){ $(this).addClass("boxClass animated bounceInLeft"); }); var onEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; $('.carousel-caption').addClass('animated bounceInLeft').one(onEnd,function(){ $(this).removeClass('animated bounceInLeft'); }); /* search tool */ $('body').on('keyup','#q',function(e){ e.preventDefault(); $thisVal = $(this).val(); //console.log($thisVal) if($thisVal.length > 3){ $.ajax({ type: "POST", cache: false, url: "/search.php", data: { search_term : $thisVal } }).done(function( resp ) { // console.log(resp); $('#results').slideDown(250); $('.page-detail').slideUp(250); $('#results').html(resp); }); } }); $('body').on('click','#removeResults',function(e){ $('#results').slideUp(250); $('#results').html(); $('.page-detail').slideDown(250); }); /* ****************** */ /* COMMENTS /* ****************** */ $("#submitCommentBtn").click(function(e) { $(document).reload(); $('#resp').html(''); e.preventDefault(); var url = "/doComments.php"; $.ajax({ type: "POST", url: url, data: $("#commentform").serialize(), success: function(data){ $('#resp').html(data); //clear everything $('#theCode').html(''); $('#code1').val(''); $('#comment_name').val(''); $('#comment_email').val(''); $('#comment').val(''); //$('#theCode').html('Enter Security Code'); } }); return false; }); /* ****************** */ /* CONTACT /* ****************** */ $("#contactFrm").hide(); $("#showContactFrmBtn").click(function(e) { e.preventDefault(); $('#contactFrm').slideDown(250) }); $("#hideContactFrmBtn").click(function(e) { e.preventDefault(); $('#contactFrm').slideUp(250); $('#contactFrm').find("input[type=text], textarea").val(''); $('#frmResp').fadeOut(250).html(''); }); $("#submitContact").click(function(e) { e.preventDefault(); $('#frmResp').html(''); var url = "/doContact.php"; $.ajax({ type: "POST", url: url, data: $("#contactForm").serialize(), success: function(data){ $('#frmResp').html(data); if(data === '
Thank you, we will be in touch shortly
'){ $('#frm_name').val(''); $('#frm_email').val(''); $('#frm_tel').val(''); $('#frm_enq').val(''); } } }); return false; }); });