SHOW:
|
|
- or go back to the newest paste.
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]; |
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' ) { |
36 | + | |
37 | if (last_url != '') { | |
38 | $("a").not('.phone a').each(function() { | |
39 | var link = $(this).attr('href'); | |
40 | var path = link.split('#')[0]; | |
41 | - | if (last_url == 'campaign=sem') { |
41 | + | |
42 | //console.log( "query: " + queryString ); | |
43 | console.log( path + '?' + last_url + '#' + hash ); | |
44 | if (hash) { | |
45 | var new_url = path + '?' + last_url + '#' + hash; | |
46 | - | $("a").each(function() { |
46 | + | } |
47 | else { | |
48 | var new_url = path + '?' + last_url; | |
49 | } | |
50 | $(this).attr ( 'href', new_url ); | |
51 | ||
52 | - | $(this).attr ( 'href', path + '?' + last_url + '#' + hash ); |
52 | + | |
53 | if ( last_url == '?campaign=seo' ) { | |
54 | $('.phone a').text('404-490-4078'); | |
55 | $('.phone a').attr('href', 'tel:4044904078'); | |
56 | } | |
57 | ||
58 | if (last_url == '?campaign=sem') { | |
59 | $('.phone a').text('404-490-4115'); | |
60 | $('.phone a').attr('href', 'tel:4044904115'); | |
61 | } | |
62 | } | |
63 | //Stop youtube video on close | |
64 | $('#stop').on('click', function() { | |
65 | //$('#popup-youtube-player').stopVideo(); | |
66 | $('#popup-youtube-player')[0].contentWindow.postMessage('{"event":"command","func":"' + 'stopVideo' + '","args":""}', '*'); | |
67 | $('.video').css('display' , 'none'); | |
68 | $('.play-button').css('display' , 'block'); | |
69 | }); | |
70 | ||
71 | //Check for contact form and Menu styles on scrolling | |
72 | $(window).scroll(function() { | |
73 | //var styledDiv = $('#contact-form'), | |
74 | var targetScroll = $('#services').position().top, | |
75 | currentScroll = $('html').scrollTop() || $('body').scrollTop(); | |
76 | //styledDiv.toggleClass('closed', currentScroll + 100 >= targetScroll); | |
77 | $('header').toggleClass('blue', currentScroll + 100 >= targetScroll); | |
78 | }); | |
79 | //Play button function | |
80 | $('.play-button').click(function() { | |
81 | $('.play-button').css('display', 'none'); | |
82 | $('.video').css('display' , 'block'); | |
83 | });//www.youtube.com/embed/kS2EFX4UHWk?rel=0 | |
84 | ||
85 | //Mobile Menu Open and Close | |
86 | $('#showMmenu, #mm_nav li a' ).click(function() { | |
87 | if ( $('#mm_nav').hasClass( 'open-menu')) { | |
88 | $('#mm_nav').removeClass('open-menu'); | |
89 | $('#showMmenu').removeClass('open-menu'); | |
90 | $('#showMmenu').html('Menu'); | |
91 | } else { | |
92 | $("#mm_nav").addClass('open-menu'); | |
93 | $('#showMmenu').addClass('open-menu'); | |
94 | $('#showMmenu').html('X'); | |
95 | } | |
96 | }); | |
97 | //Reset button closes contact form | |
98 | $('.reset').click(function(){ | |
99 | $( '#contact-form-holder' ).toggleClass( 'closed' ); | |
100 | $( '#contact-form' ).toggleClass( 'closed' ); | |
101 | }); | |
102 | ||
103 | ||
104 | $("a#inline").fancybox({ | |
105 | 'hideOnContentClick': true | |
106 | }); | |
107 | ||
108 | // Youtube fancy box | |
109 | $('.iframe').fancybox(); | |
110 | }); | |
111 | ||
112 | function getHash(url) { | |
113 | // | |
114 | // var hash = url.split("#")[1]; | |
115 | var hash = url.hash; | |
116 | console.log( "hash: " + hash ); | |
117 | return hash; | |
118 | } | |
119 | ||
120 | function getQuery(url) { | |
121 | //var url_array = url.split('?'); | |
122 | //var last_url = url_array[url_array.length - 1]; | |
123 | var query = url.search; | |
124 | return query; | |
125 | } | |
126 | ||
127 | function writeURL(url){ | |
128 | ||
129 | } |