Browse Source

Merge pull request #498 from twbs/navbar-toggle

Fix mobile navbar toggle on desktop.
pull/518/head
XhmikosR 11 years ago
parent
commit
a69a8acad2
  1. 12
      docs/assets/js/docs.js
  2. 2
      docs/assets/js/docs.min.js

12
docs/assets/js/docs.js

@ -42,13 +42,8 @@ $(function() {
footerHeight = $('.docs-footer').outerHeight(false); footerHeight = $('.docs-footer').outerHeight(false);
toolbarToggle = $('.js-docs-component-toolbar'); toolbarToggle = $('.js-docs-component-toolbar');
// exit if no device
if (!device.length) {
return;
}
// Device placement // Device placement
if (windowWidth >= 768) { if (windowWidth >= 768 && device.offset()) {
device.initialLeft = device.offset().left; device.initialLeft = device.offset().left;
device.initialTop = device.initialTop || device.offset().top; device.initialTop = device.initialTop || device.offset().top;
device.dockingOffset = ($(window).height() - device.height()) / 2; device.dockingOffset = ($(window).height() - device.height()) / 2;
@ -134,6 +129,11 @@ $(function() {
var contentSectionItem; var contentSectionItem;
var currentTop = win.scrollTop(); var currentTop = win.scrollTop();
// exit if no device
if (!device.length) {
return;
}
if ((device.initialTop - currentTop) <= device.dockingOffset) { if ((device.initialTop - currentTop) <= device.dockingOffset) {
device[0].className = 'device device-fixed'; device[0].className = 'device device-fixed';
device.css({ top: device.dockingOffset }); device.css({ top: device.dockingOffset });

2
docs/assets/js/docs.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save