<script>
$(function() {
var onScroll;
onScroll = function(e) {
var $nav_items, active_cls, scrollPos;
scrollPos = $(document).scrollTop() + 91;
$nav_items = $('.navbar-nav').find('.nav-link');
active_cls = '-active';
return $nav_items.each(function() {
var $refElement, refElement_height;
$refElement = $($(this).attr('href'));
refElement_height = $refElement.height() + parseInt($refElement.css('paddingBottom')) + parseInt($refElement.css('paddingTop'));
if ($refElement.length) {
if ($refElement.offset().top <= scrollPos && $refElement.offset().top + refElement_height > scrollPos) {
$nav_items.removeClass(active_cls);
return $(this).addClass(active_cls);
} else {
return $(this).removeClass(active_cls);
}
}
});
};
$(document).on('scroll', onScroll);
$('.navbar-nav').find('.nav-link').click(function(e) {
var $item, $nav, href, navHeight;
e.preventDefault();
$(document).off('scroll');
$item = $(e.target);
$item.addClass('-active');
$item.parent().siblings().find('.link').removeClass('-active');
href = $item.attr('href');
$nav = $('.container');
navHeight = $nav.height() + parseInt($nav.css('paddingTop')) + parseInt($nav.css('paddingBottom'));
return $('html, body').animate({
scrollTop: $(href).offset().top - navHeight
}, 1000, 'swing', function() {
return $(document).on('scroll', onScroll);
});
});
});
</script>
function randomInteger(min, max) {
var rand = min + Math.random() * (max + 1 - min);
rand = Math.floor(rand);
return rand;
}
var timerId = setInterval(function randomInteger() {
alert( randomInteger(5, 10) );
}, 86400000);
<p id="randomNum"></p>
и все ? <div id=\"vk_comments_browse\"></div>\r\n<script type=\"text/javascript\">\r\nwindow.onload = function () {\r\n VK.init({apiId: 5274267, onlyWidgets: true});\r\n VK.Widgets.CommentsBrowse('vk_comments_browse', {width: 560, limit: 5, mini: 0});\r\n}\r\n</script>