Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: src/site/js/bootstrap-subnav.js

Issue 10788006: new site (Closed) Base URL: https://code.google.com/p/dartlang-site/@master
Patch Set: final patch Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/site/js/bootstrap-dropdown.js ('k') | src/site/js/bootstrap-tab.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/site/js/bootstrap-subnav.js
diff --git a/src/site/js/bootstrap-subnav.js b/src/site/js/bootstrap-subnav.js
new file mode 100644
index 0000000000000000000000000000000000000000..a8f4c62c2691e979ccd8feabefe4ccc2fdd10846
--- /dev/null
+++ b/src/site/js/bootstrap-subnav.js
@@ -0,0 +1,15 @@
+$(document).scroll(function(){
+ // If has not activated (has no attribute "data-top"
+ if (!$('.subnav').attr('data-top')) {
+ // If already fixed, then do nothing
+ if ($('.subnav').hasClass('subnav-fixed')) return;
+ // Remember top position
+ var offset = $('.subnav').offset()
+ $('.subnav').attr('data-top', offset.top);
+ }
+
+ if ($('.subnav').attr('data-top') - $('.subnav').outerHeight() <= $(this).scrollTop())
+ $('.subnav').addClass('subnav-fixed');
+ else
+ $('.subnav').removeClass('subnav-fixed');
+});
« no previous file with comments | « src/site/js/bootstrap-dropdown.js ('k') | src/site/js/bootstrap-tab.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698