-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom.js
More file actions
77 lines (62 loc) · 2.01 KB
/
Copy pathcustom.js
File metadata and controls
77 lines (62 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* global radiateScriptParam */
jQuery(document).ready(function() {
if( radiateScriptParam.radiate_image_link === ''){
var divheight = jQuery('.header-wrap').height()+'px';
jQuery('body').css({ 'margin-top': divheight });
}
var hideSearchForm = function() {
jQuery( '#masthead .search-form' ).hide( 'slow' );
};
jQuery('.header-search-icon').click(function(){
jQuery('#masthead .search-form').toggle('slow');
// focus after some time to fix conflict with toggleClass
setTimeout( function () {
jQuery( '#masthead .search-form input' ).focus();
}, 200 );
// For esc key press.
jQuery( document ).on( 'keyup', function ( e ) {
// on esc key press.
if ( 27 === e.keyCode ) {
// if search box is opened
if ( jQuery( '#masthead' ).has( '.search-form' ) ) {
hideSearchForm();
}
}
} );
jQuery( document ).on( 'click', function( e ) {
var container = jQuery( '.search-form, .header-search-icon, .search-form input' );
if ( ! container.is( e.target ) ) {
hideSearchForm();
}
} );
});
jQuery(window).bind('scroll', function() {
header_image_effect();
});
// Scroll to top
jQuery('#scroll-up').hide();
jQuery(function () {
jQuery(window).scroll(function () {
if (jQuery(this).scrollTop() > 1000) {
jQuery('#scroll-up').fadeIn();
} else {
jQuery('#scroll-up').fadeOut();
}
});
jQuery('a#scroll-up').click(function () {
jQuery('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
});
function header_image_effect() {
var scrollPosition = jQuery(window).scrollTop();
jQuery('#parallax-bg').css('top', (0 - (scrollPosition * 0.2)) + 'px');
}
jQuery(document).ready(function() {
jQuery('.better-responsive-menu #site-navigation .menu-toggle').click(function() {
jQuery('.better-responsive-menu #site-navigation .menu-primary-container > ul,.better-responsive-menu #site-navigation .menu > ul').slideToggle('slow');
});
});