$(function($) {
/* Var */
var $body_html = $('body, html'),
$html = $('html'),
$body = $('body'),
$navigation = $('#navigation'),
navigation_height = $navigation.height() - 20,
$scroll_to_top = $('#scroll-to-top');
if (navigation_height <= 0) navigation_height = 60;
/* mobile */
var ua_test = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i,
is_mobile = ua_test.test(navigator.userAgent);
$html.addClass(is_mobile ? 'mobile' : 'no-mobile');
/* Scroll */
$body.scrollspy({
offset: 51,
target: '#navigation'
});
/* Affixed Nav */
$('.affix').affix({
offset: {
top: navigation_height
}
});
/* Dropdown */
if (is_mobile) {
$('.dropdown-toggle').each(function() {
$(this).attr('data-toggle', 'dropdown');
});
}
});