|
|
@ -22,20 +22,23 @@ $(function() { |
|
|
|
doc = $(document); |
|
|
|
doc = $(document); |
|
|
|
bod = $(document.body) |
|
|
|
bod = $(document.body) |
|
|
|
device = device || $('.js-device'); |
|
|
|
device = device || $('.js-device'); |
|
|
|
navComponentLinks = $('.docs-nav'); |
|
|
|
//navComponentLinks = $('.docs-nav');
|
|
|
|
componentsList = $('.components-list'); |
|
|
|
componentsList = $('.components-list'); |
|
|
|
componentLinks = $('.component-example a'); |
|
|
|
componentLinks = $('.component-example a'); |
|
|
|
contentSection = $('.component'); |
|
|
|
contentSection = $('.component'); |
|
|
|
topCache = contentSection.map(function () { return $(this).offset().top }) |
|
|
|
topCache = contentSection.map(function () { return $(this).offset().top }) |
|
|
|
windowHeight = $(window).height() / 3 |
|
|
|
windowHeight = $(window).height() / 3 |
|
|
|
|
|
|
|
windowWidth = $(window).width(); |
|
|
|
pageHeight = $(document).height(); |
|
|
|
pageHeight = $(document).height(); |
|
|
|
contentPadding = parseInt($('.docs-content').css('padding-bottom')); |
|
|
|
contentPadding = parseInt($('.docs-content').css('padding-bottom')); |
|
|
|
footerHeight = $('.docs-footer').outerHeight(false); |
|
|
|
footerHeight = $('.docs-footer').outerHeight(false); |
|
|
|
|
|
|
|
|
|
|
|
// Device placment
|
|
|
|
// Device placment
|
|
|
|
device.initialLeft = device.offset().left; |
|
|
|
if (windowWidth >= 768) { |
|
|
|
device.initialTop = device.initialTop || device.offset().top; |
|
|
|
device.initialLeft = device.offset().left; |
|
|
|
device.dockingOffset = ($(window).height() - device.height())/2; |
|
|
|
device.initialTop = device.initialTop || device.offset().top; |
|
|
|
|
|
|
|
device.dockingOffset = ($(window).height() - device.height())/2;
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
checkDesktopContent(); |
|
|
|
checkDesktopContent(); |
|
|
|
calculateScroll(); |
|
|
|
calculateScroll(); |
|
|
@ -50,6 +53,15 @@ $(function() { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mobile navigation
|
|
|
|
|
|
|
|
$('.js-docs-nav-trigger').on('click', function () { |
|
|
|
|
|
|
|
var nav = $('.docs-nav-group'); |
|
|
|
|
|
|
|
var trigger = $('.js-docs-nav-trigger'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trigger.toggleClass('active'); |
|
|
|
|
|
|
|
nav.toggleClass('active');
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// navComponentLinks.click(function(e) {
|
|
|
|
// navComponentLinks.click(function(e) {
|
|
|
|
// e.stopPropagation();
|
|
|
|
// e.stopPropagation();
|
|
|
|
// e.preventDefault();
|
|
|
|
// e.preventDefault();
|
|
|
@ -82,7 +94,6 @@ $(function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
win.on('scroll', calculateScroll); |
|
|
|
win.on('scroll', calculateScroll); |
|
|
|
win.on('scroll', calculateToggle); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var checkDesktopContent = function () { |
|
|
|
var checkDesktopContent = function () { |
|
|
@ -136,27 +147,6 @@ $(function() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Platform toggle
|
|
|
|
|
|
|
|
var initializeToggle = function () { |
|
|
|
|
|
|
|
platformToggle = $('.platform-toggle'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Toggle placment
|
|
|
|
|
|
|
|
toggleTop = platformToggle.offset().top; |
|
|
|
|
|
|
|
toggleHeight = platformToggle.outerHeight(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
calculateToggle(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var calculateToggle = function () { |
|
|
|
|
|
|
|
var currentTop = win.scrollTop(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(currentTop >= toggleTop) { |
|
|
|
|
|
|
|
platformToggle.addClass('fixed'); |
|
|
|
|
|
|
|
} else if (currentTop <= $('.docs-header').outerHeight()) { |
|
|
|
|
|
|
|
platformToggle.removeClass('fixed'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(window).on('load resize', initialize); |
|
|
|
$(window).on('load resize', initialize); |
|
|
|
$(window).on('load', initializeToggle); |
|
|
|
|
|
|
|
$(window).on('load', function () { new FingerBlast('.device-content'); }); |
|
|
|
$(window).on('load', function () { new FingerBlast('.device-content'); }); |
|
|
|
}); |
|
|
|
}); |
|
|
|