Post by shoptadka » Mon Dec 11, 2017 6:45 pm

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

New member

Posts

Joined
Wed May 30, 2012 1:03 am

Post by DigitCart » Mon Dec 11, 2017 6:47 pm

Hi,
Please provide a live url to your store.

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by shoptadka » Mon Dec 11, 2017 7:06 pm


New member

Posts

Joined
Wed May 30, 2012 1:03 am

Post by DigitCart » Mon Dec 11, 2017 7:14 pm

Add this:

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');
	}
});
to the end of this file:

Code: Select all

catalog/view/theme/pav_vigoss/javascript/common.js
And add this:

Code: Select all

.sticky {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 99999;
	width: 100%;
	background-color: #fff;
}
to the end of this file:

Code: Select all

catalog/view/theme/pav_vigoss/stylesheet/stylesheet.css
Then clear your browser cache and check it.

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by shoptadka » Tue Dec 12, 2017 3:11 pm

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.

New member

Posts

Joined
Wed May 30, 2012 1:03 am

Post by DigitCart » Tue Dec 12, 2017 4:12 pm

You have inserted the codes incorrectly.
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');
		}
	});
});

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by shoptadka » Tue Dec 12, 2017 7:10 pm

Thanks brother its fixed much appreciate god bless you. do you have more help for me if i needed...

New member

Posts

Joined
Wed May 30, 2012 1:03 am

Post by DigitCart » Tue Dec 12, 2017 8:02 pm

shoptadka wrote:
Tue Dec 12, 2017 7:10 pm
Thanks brother its fixed much appreciate god bless you. do you have more help for me if i needed...
You are welcome.
Post your problems here in the forum.
Me and other members will help you.

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by shoptadka » Wed Dec 13, 2017 3:42 pm

Thanks mate i will post some.

New member

Posts

Joined
Wed May 30, 2012 1:03 am

Post by shoptadka » Fri Dec 15, 2017 4:16 pm

bro can you check this issue too.

viewtopic.php?f=191&t=200477&p=707142#p707142
i am facing this issue as well

New member

Posts

Joined
Wed May 30, 2012 1:03 am
Who is online

Users browsing this forum: No registered users and 25 guests