jQuery.noConflict(); jQuery(document).ready(function($){ $('.carousel').carousel({ interval : 5500 }) $(document).scroll(function(){ if($(this).scrollTop() > 100){ $('#toTop').fadeIn(250); }else{ $('#toTop').fadeOut(250); } }); /* $(document).scroll(function(){ if($(this).scrollTop() > 190){ $('.navbarmid').addClass('fixedPos') }else{ $('.navbarmid').removeClass('fixedPos') } }); */ $("#toTop").click(function(e){ e.preventDefault(); var dest = 0; $('html,body').stop().animate({ scrollTop: dest }, 500, 'swing'); }); $(".fancybox").fancybox({ padding: 0, openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', closeSpeed : 150, closeClick : true }); $("img").addClass('responsive-image'); $("table").addClass('table table-responsive'); /* transitions */ /* page waypoint control */ $('.wp1').waypoint(function() { $('.wp1').addClass('animated fadeInLeft'); }, { offset: '65%' }); $('.wp2').waypoint(function() { $('.wp2').addClass('animated fadeInRight'); }, { offset: '65%' }); $('.wp3').waypoint(function() { $('.wp3').addClass('animated fadeInUp'); }, { offset: '75%' }); $(".logo").appear(); $(".logo").addClass("animated fadeInDown d01s"); var onEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; $('.logo').one(onEnd,function(){ $(this).removeClass('animated fadeInDown d01s'); }); /* *************** */ //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); }); $(".fancybox").fancybox({ padding: 0, openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', closeSpeed : 150, closeClick : true }); /* ****************** */ /* COMMENTS /* ****************** */ $("#submitCommentBtn").click(function(e) { $('#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) var aTag = $("#navbarmid"); $('html,body').animate({scrollTop: aTag.offset().top},'slow'); }); $("#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; }); });