Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to destroy enscroll at some resolution? #72

Open
vedankita opened this issue Dec 20, 2016 · 7 comments
Open

How to destroy enscroll at some resolution? #72

vedankita opened this issue Dec 20, 2016 · 7 comments

Comments

@vedankita
Copy link

vedankita commented Dec 20, 2016

I want normal scrolling for mobile version that and want to keep enscroll for desktop. How can I destroy this plugin for mobile?

@xahon
Copy link

xahon commented Jan 17, 2017

I've found a solution. Just use $(".selector").enscroll('destroy'); within if ($(window).width() <= 400)

@vedankita
Copy link
Author

thanks @xahon

@intsfanatic
Copy link

What if i want to turn off enscroll at 768px, but turn it back on at wider screen when the window is resized or orientation is changed? Thanks

@vedankita
Copy link
Author

you can call function for enscroll on $(window).resize when if ($(window).width() > 768) and vice versa

@intsfanatic
Copy link

$(window).resize(function(){
	var w = $(window).width();
	if(w<1000){
		$('.main-wrap').enscroll('destroy');
	}else{
		$('.main-wrap').enscroll({
			verticalScrolling: true,
			scrollIncrement: 50,
			easingDuration: 250,
			addPaddingToPane: false,
			drawScrollButtons: true,
			verticalTrackClass: 'vertical-track2',
			verticalHandleClass: 'vertical-handle2',
			cornerClass: 'corner2'
		});
	}
})

Like this? It doesnt work for me, just keeps creating multiple scrollbars, gives an error "type e is null" and doesnt update the scrollbar position.

@vedankita
Copy link
Author

vedankita commented Mar 24, 2017

$(window).resize(function(){
var w = $(window).width();
if(w<1000){
$('.main-wrap').enscroll('destroy');
}else{
$('.main-wrap').enscroll('destroy');
$('.main-wrap').enscroll({
verticalScrolling: true,
scrollIncrement: 50,
easingDuration: 250,
addPaddingToPane: false,
drawScrollButtons: true,
verticalTrackClass: 'vertical-track2',
verticalHandleClass: 'vertical-handle2',
cornerClass: 'corner2'
});
}
})

Please try this. Let me it its works.

@intsfanatic
Copy link

Actually i does work, thanks mate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants