diff --git a/docs/assets/js/application-scrollspy.js b/docs/assets/js/application-scrollspy.js deleted file mode 100644 index 1f0b7cebe2..0000000000 --- a/docs/assets/js/application-scrollspy.js +++ /dev/null @@ -1,39 +0,0 @@ -// scroll spy logic -// ================ -$(function () { - - var activeTarget, - position = {}, - $window = $(window), - nav = $('body > .topbar li a'), - targets = nav.map(function () { - return $(this).attr('href'); - }), - offsets = $.map(targets, function (id) { - return $(id).offset().top; - }); - - function setButton(id) { - nav.parent("li").removeClass('active'); - $(nav[$.inArray(id, targets)]).parent("li").addClass('active'); - } - - function processScroll(e) { - var scrollTop = $window.scrollTop() + 10, i; - for (i = offsets.length; i--;) { - if (activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1])) { - activeTarget = targets[i]; - setButton(activeTarget); - } - } - } - - nav.click(function () { - processScroll(); - }); - - processScroll(); - - $window.scroll(processScroll); - -}) \ No newline at end of file diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 86eefa89d1..d1c6751ea2 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -6,6 +6,12 @@ $(document).ready(function(){ $('body').dropdown() // catch any dropdowns on the page + // Scrollspy + // ========= + + $('body > .topbar').scrollSpy() + + // table sort example // ================== diff --git a/docs/index.html b/docs/index.html index 64f95c6daf..f914b31b24 100644 --- a/docs/index.html +++ b/docs/index.html @@ -23,8 +23,8 @@ + - @@ -1519,7 +1519,7 @@ Lorem ipsum dolar sit amet illo error ipsum verita
Integrating javascript with the Bootstrap library is super easy. Below we go over the basics and provide you with some awesome plugins to get you started!
We've set out to make your interactive work with Bootstrap even more simple, offering several lightweight plugins for things like modals, tooltips, and other dynamic components. These plugins have been coded up to work with either jQuery or Ender, but we encourage you to extend and modify them to fit your development needs!
The short answer is no... of course not! However, for those who need it, we've provided the plugins below to help you understand how to integrate bootstrap with javascript and to give you a quick lightweight option for dropping something in and getting the basic functionality right away! For more information on these plugins and to see demos of them in action, please refer to our plugin documentation page.
diff --git a/docs/javascript.html b/docs/javascript.html index bc3372fabd..294f5dbe4b 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -15,12 +15,12 @@ - + @@ -46,6 +46,7 @@This plugin is for adding the scrollspy (auto updating nav) interaction to the bootstrap topbar.
+ Download +$('#topbar').dropdown()+
+ Auto activates navigation buttons by users scroll position. +
+$('body > .topbar').scrollSpy()+
+ Note: Topbar anchor tags must have resolvable id targets like <a href="#home">home</a>
.
+
The scrollspy caches nav buttons and anchor locations. If you need to update the cache (because you have dynamic content) just trigger the scrollspy:refresh
event.
$('body > .topbar').trigger('scrollspy:refresh')+
Peep the topbar navigation homie!
+ +