Advertisement
Guest User

ka4

a guest
Oct 1st, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(document).ready(function( $ ) {
  2.  
  3.   $(window).load(function() {
  4.     $('.flexslider').flexslider({
  5.       animation: "slide",
  6.       controlNav: false,
  7.       directionNav: false,
  8.     });
  9.   });
  10.  
  11. //Change Main image size on load
  12.   var $windowheight = $(window).height();
  13.   $('#top-content').css('height', $windowheight );
  14.   $('.play-button img').css('margin-top', $windowheight/2 - 75 );
  15.   $('.video').css('margin-top', $windowheight/2 - 140 );
  16.  
  17.   $(window).resize(function() {
  18.     //Change Main image size on window resize
  19.     var $windowheight = $(window).height();
  20.     $('#top-content').css('height', $windowheight );
  21.     $('.play-button img').css('margin-top', $windowheight/2 - 75 );
  22.     $('.video').css('margin-top', $windowheight/2 - 140 );
  23.   });
  24.  
  25.   $( '#contact-form-holder' ).click(function() {
  26.     $( this ).toggleClass( 'closed' );
  27.     $( '#contact-form' ).toggleClass( 'closed' );
  28.   });
  29.  
  30. //Change Phone Numbers off of URL Parameters
  31.   var url = jQuery(window.location).attr("href");
  32.   var a = $('<a>' { href:url })[0];
  33.   var last_url = getQuery(a);
  34.   var hash_url = getHash(a);
  35.   //console.log(last_url);
  36.     if ( last_url == 'campaign=seo' ) {
  37.         $('.phone a').text('404-490-4078');
  38.         $('.phone a').attr('href', 'tel:4044904078');
  39.     }
  40.  
  41.     if (last_url == 'campaign=sem') {
  42.         $('.phone a').text('404-490-4115');
  43.         $('.phone a').attr('href', 'tel:4044904115');
  44.     }
  45.     if (last_url != '') {
  46.       $("a").each(function() {
  47.           var link = $(this).attr('href');
  48.           var path = link.split('#')[0];
  49.           var hash = link.split('#')[1];
  50.           //console.log( "query: " + queryString );
  51.           console.log( path + '?' + last_url + '#' + hash );
  52.           $(this).attr ( 'href', path + '?' + last_url + '#' + hash );
  53.  
  54.       });
  55.     }
  56. //Stop youtube video on close
  57.   $('#stop').on('click', function() {
  58.     //$('#popup-youtube-player').stopVideo();
  59.     $('#popup-youtube-player')[0].contentWindow.postMessage('{"event":"command","func":"' + 'stopVideo' + '","args":""}', '*');
  60.     $('.video').css('display' , 'none');
  61.     $('.play-button').css('display' , 'block');
  62.   });
  63.  
  64. //Check for contact form and Menu styles on scrolling
  65.   $(window).scroll(function() {
  66.         //var styledDiv = $('#contact-form'),
  67.            var targetScroll = $('#services').position().top,
  68.             currentScroll = $('html').scrollTop() || $('body').scrollTop();
  69.         //styledDiv.toggleClass('closed', currentScroll + 100 >= targetScroll);
  70.         $('header').toggleClass('blue', currentScroll + 100 >= targetScroll);
  71.     });
  72.   //Play button function
  73.   $('.play-button').click(function() {
  74.     $('.play-button').css('display', 'none');
  75.     $('.video').css('display' , 'block');
  76.   });//www.youtube.com/embed/kS2EFX4UHWk?rel=0
  77.  
  78. //Mobile Menu Open and Close
  79.   $('#showMmenu, #mm_nav li a' ).click(function() {
  80.     if ( $('#mm_nav').hasClass( 'open-menu')) {
  81.       $('#mm_nav').removeClass('open-menu');
  82.       $('#showMmenu').removeClass('open-menu');
  83.       $('#showMmenu').html('Menu');
  84.     } else {
  85.       $("#mm_nav").addClass('open-menu');
  86.       $('#showMmenu').addClass('open-menu');
  87.       $('#showMmenu').html('X');
  88.     }
  89.   });
  90. //Reset button closes contact form
  91.   $('.reset').click(function(){
  92.     $( '#contact-form-holder' ).toggleClass( 'closed' );
  93.     $( '#contact-form' ).toggleClass( 'closed' );
  94.   });
  95.  
  96.  
  97.   $("a#inline").fancybox({
  98.     'hideOnContentClick': true
  99.   });
  100.  
  101.   // Youtube fancy box
  102.   $('.iframe').fancybox();
  103. });
  104.  
  105. function getHash(url) {
  106. //
  107. //  var hash = url.split("#")[1];
  108.   var hash = url.hash;
  109.   console.log( "hash: " + hash );
  110.   return hash;
  111. }
  112.  
  113. function getQuery(url) {
  114.   //var url_array = url.split('?');
  115.   //var last_url = url_array[url_array.length - 1];
  116.   var query = url.search;
  117.   return query;
  118. }
  119.  
  120. function writeURL(url){
  121.  
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement