summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Park <thomas@thomaspark.me>2012-12-27 23:07:25 -0500
committerThomas Park <thomas@thomaspark.me>2012-12-27 23:07:25 -0500
commit6176f1b12d9099e891dd8192cedcbd1e1b6cca6a (patch)
treec9f1e75de1addaf2663af64eaacc59fc1e6fda95
parente9b46a94bc720ef109bbcf9a21222410f680cba9 (diff)
clean up javascript code
-rwxr-xr-xjs/application.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/js/application.js b/js/application.js
index 670947ce..cd7cf0c9 100755
--- a/js/application.js
+++ b/js/application.js
@@ -1,29 +1,29 @@
-!function ($) {
+(function ($) {
- $(function(){
+ $(function(){
- // fix sub nav on scroll
- var $win = $(window)
- , $nav = $('.subnav')
- , navHeight = $('.navbar').first().height()
- , navTop = $('.subnav').length && $('.subnav').offset().top - navHeight
- , isFixed = 0
+ // fix sub nav on scroll
+ var $win = $(window),
+ $nav = $('.subnav'),
+ navHeight = $('.navbar').first().height(),
+ navTop = $('.subnav').length && $('.subnav').offset().top - navHeight,
+ isFixed = 0;
- processScroll()
+ processScroll();
- $win.on('scroll', processScroll)
+ $win.on('scroll', processScroll);
- function processScroll() {
- var i, scrollTop = $win.scrollTop()
- if (scrollTop >= navTop && !isFixed) {
- isFixed = 1
- $nav.addClass('subnav-fixed')
- } else if (scrollTop <= navTop && isFixed) {
- isFixed = 0
- $nav.removeClass('subnav-fixed')
- }
- }
+ function processScroll() {
+ var i, scrollTop = $win.scrollTop();
+ if (scrollTop >= navTop && !isFixed) {
+ isFixed = 1;
+ $nav.addClass('subnav-fixed');
+ } else if (scrollTop <= navTop && isFixed) {
+ isFixed = 0;
+ $nav.removeClass('subnav-fixed');
+ }
+ }
- })
+ });
-}(window.jQuery) \ No newline at end of file
+})(window.jQuery); \ No newline at end of file