garand / sticky

jQuery Plugin for Sticky Objects
Other
3.3k stars 1.06k forks source link

[FEATURE] Option "disable on mobile devices" #216

Open schmitzal opened 8 years ago

schmitzal commented 8 years ago

Hey there,

frist of all, thanks for this great working script.

I just wanted to suggest a new option to disable the sticky header on mobile devices. In my use case, i dont want the header to be sticky on movile devices, because its way to big for that.

What do you think about it?

Kind regards, Alex

groundnation commented 8 years ago

+1

brunomonteiro3 commented 8 years ago

I think the best solution available now is to check the window width and based on that, start the plugin.

For example:

var windowW = $(window).innerWidth();

if (windowW <= 960) {
     $('.element).sticky();
}
schmitzal commented 8 years ago

Yes, of course. Or using a touch device recognition library or this device check strings.

But it would be much more comfortable to just set an option in the plugin to disable it on touch devices or even better to separately define it for phone, tablet and desktop.

acjbizar commented 6 years ago

Optional lower and upper limits in pixels would make a lot of sense.