scroller fixed

This commit is contained in:
prateek srivastava 2019-04-18 12:58:35 +05:30
parent df8f54597a
commit 16b2b2a01f
1 changed files with 78 additions and 0 deletions

View File

@ -8,6 +8,84 @@ Vue.prototype.$http = axios
window.eventBus = new Vue();
window.onload = function () {
$(document).ready(function() {
navbarLeftCssTop = parseInt($('.navbar-left').css("top"));
windowHeight = $(window).height();
menubarHeight = $('ul.menubar').height();
documentHeight = $(document).height();
contentHeight = $('.content').height();
innerSectionHeight = $('.inner-section').height();
asideNavHeight = $('.aside-nav').height();
pageContentHeight = $('.page-content').height();
accordianHeight = $('.accordian').height();
if (menubarHeight < windowHeight) {
differenceInHeight = windowHeight - menubarHeight;
} else {
differenceInHeight = menubarHeight - windowHeight;
}
if(pageContentHeight <= innerSectionHeight - 60) {
$('.navbar-left').css("position","absolute");
$('.content').css({"position": "fixed", "width": "65%"});
$('.content-wrapper').css({"position": "sticky", "top": "60px"});
}
else {
$('.accordian-header').on('click',function(event) {
pageContentHeightOnAccordianClick = $('.page-content').height();
if(pageContentHeightOnAccordianClick <= innerSectionHeight) {
$('.navbar-left').css("position","absolute");
$('.content').css("position","fixed");
$('.content-wrapper').css({"position": "sticky", "top": "60px"});
}
});
}
scrollTopWhenWindowLoaded = $(document).scrollTop();
if (menubarHeight > documentHeight && menubarHeight > windowHeight) {
$(document).scroll(function() {
documentScrollWhenScrolled = $(document).scrollTop();
if (documentScrollWhenScrolled <= differenceInHeight + 200) {
$('.navbar-left').css('top', documentScrollWhenScrolled + 60 + 'px');
scrollTopValueWhenNavBarFixed = $(document).scrollTop();
}
});
} else if (menubarHeight < windowHeight) {
$('.navbar-left').css("position", "fixed");
} else if (menubarHeight < documentHeight) {
if (scrollTopWhenWindowLoaded > differenceInHeight) {
$('.navbar-left').css('top', -differenceInHeight + 'px');
}
if (menubarHeight > windowHeight) {
$(document).scroll(function() {
documentScrollWhenScrolled = $(document).scrollTop();
if (documentScrollWhenScrolled <= differenceInHeight + 200) {
$('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px');
scrollTopValueWhenNavBarFixed = $(document).scrollTop();
}
});
} else if (menubarHeight < windowHeight) {
$(document).scroll(function() {
documentScrollWhenScrolled = $(document).scrollTop();
if (documentScrollWhenScrolled <= differenceInHeight + 70) {
$('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px');
scrollTopValueWhenNavBarFixed = $(document).scrollTop();
}
});
}
}
});
}
$(document).ready(function () {
Vue.config.ignoredElements = [
'option-wrapper',