Created
October 23, 2012 20:07
-
-
Save shane-reaume/3941194 to your computer and use it in GitHub Desktop.
jQuery scroll function, first jQuery set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global window */ | |
/*global jQuery */ | |
jQuery.noConflict(); | |
/* scroll and viewportwidth functions start shane *************************************************************** */ | |
jQuery(window.document).scroll(function () { | |
"use strict"; | |
// Declare variables | |
var $el, viewportWidth, $ezblogmenu, $discussRight, $s_right; | |
$el = jQuery('.fixedElement'); | |
viewportWidth = jQuery(window).width(); | |
$ezblogmenu = jQuery('#ezblog-menu'); | |
$discussRight = jQuery('.discuss-categories').parent().parent().parent().parent().parent(); | |
$s_right = jQuery('#s5_header_right'); | |
if (jQuery(this).scrollTop() > 120 && $el.css('position') !== 'fixed') { | |
jQuery('.s5_light_modules').css('margin-top', '30px'); | |
jQuery('.fixedElement').css('background', 'linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('.fixedElement').css('background', '-ms-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('.fixedElement').css('background', '-moz-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('.fixedElement').css('background', '-o-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('.fixedElement').css('background', '-webkit-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('.fixedElement').css('background', '-webkit-gradient(linear, left top, left bottom, color-stop(70% #00172A), color-stop(100%,#2F71B3))'); | |
jQuery('.fixedElement').css({ | |
'position': 'fixed', | |
'top': '0', | |
'z-index': '9990', | |
'width': '120%', | |
'paddingRight': '20%', | |
'paddingLeft': '20%', | |
'marginLeft': '-10%', | |
'left': '0', | |
'boxShadow': '0 3px 5px #888888', | |
'lineHeight': '100%', | |
'paddingTop': '0', | |
'paddingBottom': '0', | |
'color': '#ffffff' | |
}); | |
jQuery('#subMenusContainer .S5_submenu_item').css({'background': '#00172A'}); | |
/*jQuery('#subMenusContainer').css({'visibility':'hidden'}); | |
jQuery('#subMenusContainer div').css({'visibility':'hidden'});*/ | |
jQuery('#subMenusContainer ul, #subMenusContainer ul li, #subMenusContainer a').css({'color': '#ffffff', 'background': '#00172A'}); | |
jQuery('#s5_nav li a, .s5_subtext').css({'color': '#ffffff'}); | |
jQuery('.S5_parent_subtext').css({'visibility': 'hidden'}); | |
jQuery('.s5_level1_span2').css({'height': '20px'}); | |
jQuery('#s5_nav li .s5_level1_span1').css('background', 'linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('#s5_nav li .s5_level1_span1').css('background', '-ms-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('#s5_nav li .s5_level1_span1').css('background', '-moz-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('#s5_nav li .s5_level1_span1').css('background', '-o-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('#s5_nav li .s5_level1_span1').css('background', '-webkit-linear-gradient(top, #00172A 70%, #2F71B3 100%)'); | |
jQuery('#s5_nav li .s5_level1_span1').css('background', '-webkit-gradient(linear, left top, left bottom, color-stop(70% #00172A), color-stop(100%,#2F71B3))'); | |
} | |
/* if user scrolls back to top fix -shane */ | |
if (jQuery(this).scrollTop() < 120 && $el.css('position') === 'fixed') { | |
jQuery('.s5_light_modules').css('margin-top', '0'); | |
jQuery('.fixedElement').css({ | |
'borderBottomColor': '#ffffff', | |
'position': 'static', | |
'top': '0px', | |
'width': '100%', | |
'paddingRight': '0', | |
'paddingLeft': '0', | |
'marginLeft': '0', | |
'left': '0', | |
'boxShadow': '0 1px 3px rgba(0, 0, 0, 0.11) inset', | |
'background': '#FFFFFF url(/templates/diabetes_network/images/s5_menu_bg.png) repeat-x bottom left', | |
'lineHeight': '140%' | |
}); | |
jQuery('#subMenusContainer .S5_submenu_item').css({'background': '#ffffff'}); | |
jQuery('#subMenusContainer, #subMenusContainer div').css({'visibility': 'visible'}); | |
/*jQuery('.S5_parent_subtext').css({'color':'#333333'}); */ | |
jQuery('.S5_parent_subtext').css({'visibility': 'visible'}); | |
jQuery('#s5_nav li a').css({'color': '#333333'}); | |
jQuery('#s5_nav li .s5_level1_span1').css({'background': 'transparent'}); | |
jQuery('#subMenusContainer ul,#subMenusContainer ul li, #subMenusContainer a').css({ | |
'color': '#000000', | |
'background': '#ffffff' | |
}); | |
jQuery('.S5_parent_subtext, #s5_nav li a').css({ | |
'color': '#000000', | |
'visibility': 'visible' | |
}); | |
jQuery('.s5_level1_span2').css({'height': '48px'}); | |
jQuery('.s5_subtext').css({'color': '#000000!important'}); | |
} | |
/*if (jQuery(this).scrollTop() > 300 && $ezblogmenu.css('position') !== 'fixed' && viewportWidth > '800' && $ezblogmenu === true) { | |
jQuery('#ezblog-menu').css({ | |
'position': 'fixed', | |
'top': '35px', | |
'z-index': '9989', | |
'width': '101%', | |
'left': '1px', | |
'borderBottomColor': '#00172A', | |
'boxShadow': '0 3px 5px #888888' | |
}); | |
jQuery(".blog-navi li.toolbar-item.user-access.float-r").css({'marginRight': '6px'}); | |
jQuery(".fixedElement").css({'boxShadow': 'none', 'borderBottomColor': '#2D6DAD'}); | |
jQuery("#ezblog-menu .blog-navi").css({'background': '#2D6DAD', 'borderBottomColor': '#00172A', 'borderTopColor': '#2D6DAD'}); | |
jQuery($s_right).css({'marginTop': '25px'}); | |
} | |
if (jQuery(this).scrollTop() < 300 && $ezblogmenu.css('position') === 'fixed') { | |
jQuery('#ezblog-menu').css({ | |
'position': 'static', | |
'top': '35px', | |
'z-index': '9989', | |
'width': '100%', | |
'left': '1px', | |
'borderBottomColor': '#E8E8E8', | |
'boxShadow': 'none' | |
}); | |
jQuery("#ezblog-menu .blog-navi").css({'background': '#ffffff', 'borderBottomColor': '#ffffff', 'borderTopColor': '#ffffff'}); | |
jQuery(".fixedElement").css({'borderBottomColor': '#ffffff'}); | |
jQuery($s_right).css({'marginTop': '45px'}); | |
} */ | |
/*discuss left*/ | |
/*if (jQuery(this).scrollTop() > 200 && $discus.css('position') !== 'fixed' && viewportWidth > '800') { | |
jQuery($discus).css({'position': 'fixed', 'top': '0', 'padding-top': '55px'}); | |
} | |
if (jQuery(this).scrollTop() < 200 && $discus.css('position') === 'fixed') { | |
jQuery($discus).css({'position': 'static', 'top': '30', 'padding-top': '5px'}); | |
} */ | |
/*discuss right*/ | |
/* if (jQuery(this).scrollTop() > 200 && $discussRight.css('position') !== 'fixed' && viewportWidth > '800') { | |
jQuery($discussRight).css({'position': 'fixed', 'top': '0', 'padding-top': '55px'}); | |
} | |
if (jQuery(this).scrollTop() < 200 && $discussRight.css('position') === 'fixed') { | |
jQuery($discussRight).css({'position': 'static', 'top': '30', 'padding-top': '5px'}); | |
} */ | |
/*viewportWidth header right*/ | |
if (jQuery(this).scrollTop() > 200 && $s_right.css('position') !== 'fixed' && viewportWidth > '1036') { | |
jQuery($s_right).css({'position': 'fixed', 'top': '0', 'right': '0', 'marginTop': '45px', 'zIndex': '9989', | |
'background': 'rgba(0,23,42,0.6)', 'borderBottomLeftRadius': '10px', 'borderTopLeftRadius': '10px', | |
'boxShadow': '-3px 3px 5px #999999', 'padding': '5px'}); | |
jQuery('#s5_loginreg').css({'color': '#ffffff'}); | |
jQuery('.nsb_container').css({'display': 'inline-block', 'paddingTop': '15px'}); | |
} | |
if (jQuery(this).scrollTop() < 200 && $s_right.css('position') === 'fixed') { | |
jQuery($s_right).css({'position': 'static', 'top': '30', 'marginTop': '0', 'background': 'none', 'boxShadow': 'none', 'padding': '0'}); | |
jQuery('#s5_loginreg').css({'color': '#2F71B3'}); | |
jQuery('.nsb_container').css({'display': 'none'}); | |
} | |
}); | |
/* mask for phone number form input -shane*/ | |
jQuery(function ($e) { | |
"use strict"; | |
$e('#refer').val(window.location.href); | |
$e.mask.definitions['~'] = '[+-]'; | |
$e('#phone').mask('(999)999-9999'); | |
$e('#field_phone_number').mask('999-999-9999'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment