Hi i am using opencart 2.2.0.0 version with pav vigoss them i want someone to help me with to make it possible i want top header stick on top when scroll the page please help me in this.
Thank you
Add this:
to the end of this file:
And add this:
to the end of this file:
Then clear your browser cache and check it.
Code: Select all
var div = '#top + .top-center';
var windowScrollTop = $(window).scrollTop();
var divOffsetTop = $(div).offset().top;
if(windowScrollTop > divOffsetTop){
$(div).addClass('sticky');
} else {
$(div).removeClass('sticky');
}
$(window).on('scroll', function(){
var windowScrollTop = $(window).scrollTop();
if(windowScrollTop > divOffsetTop){
$(div).addClass('sticky');
} else {
$(div).removeClass('sticky');
}
});
Code: Select all
catalog/view/theme/pav_vigoss/javascript/common.js
Code: Select all
.sticky {
position: fixed;
left: 0;
top: 0;
z-index: 99999;
width: 100%;
background-color: #fff;
}
Code: Select all
catalog/view/theme/pav_vigoss/stylesheet/stylesheet.css
Thanks mate i did same as you said but still its not working you can check it out www.neerushaa.com please help me out mate.
You have inserted the codes incorrectly.
Place the CSS code in the CSS file.
And put js (jquery) code inside $(function(){}); like this:
Place the CSS code in the CSS file.
And put js (jquery) code inside $(function(){}); like this:
Code: Select all
$(function(){
var div = '#top + .top-center';
var windowScrollTop = $(window).scrollTop();
var divOffsetTop = $(div).offset().top;
if(windowScrollTop > divOffsetTop){
$(div).addClass('sticky');
} else {
$(div).removeClass('sticky');
}
$(window).on('scroll', function(){
var windowScrollTop = $(window).scrollTop();
if(windowScrollTop > divOffsetTop){
$(div).addClass('sticky');
} else {
$(div).removeClass('sticky');
}
});
});
You are welcome.
Post your problems here in the forum.
Me and other members will help you.
bro can you check this issue too.
viewtopic.php?f=191&t=200477&p=707142#p707142
i am facing this issue as well
viewtopic.php?f=191&t=200477&p=707142#p707142
i am facing this issue as well
Who is online
Users browsing this forum: No registered users and 52 guests