Skip to content

min_width option so element is always unstuck in smaller viewports#149

Open
code418 wants to merge 2 commits intoleafo:masterfrom
code418:minwidth
Open

min_width option so element is always unstuck in smaller viewports#149
code418 wants to merge 2 commits intoleafo:masterfrom
code418:minwidth

Conversation

@code418
Copy link
Copy Markdown

@code418 code418 commented Jan 12, 2016

A new option to disable the sticky behaviour based on viewport width

$(el).stick_in_parent({
     min_width: 768,
});

Useful for some responsive layout requirements without the need to destroy and reinitialise.

@samburgers
Copy link
Copy Markdown

+1

1 similar comment
@samuelsiau
Copy link
Copy Markdown

+1

@samburgers
Copy link
Copy Markdown

Hi, any plan to implement this?

@andrew-ireland
Copy link
Copy Markdown

+1

@samuelsiau
Copy link
Copy Markdown

+1

1 similar comment
@rahulv3a
Copy link
Copy Markdown

+1

@utilmind
Copy link
Copy Markdown

utilmind commented Apr 1, 2017

I have implemented it myself. Not with class option, but with global quick variable:

var min_stickykit_width = 768; // minimum client width required the "Sticky-kit" to work.

// + modified the following line of code, right before "fixed = true;":
// was:
if (scroll > top) {
// now:
if (scroll > top && $(document).width() >= min_stickykit_width) {

@utilmind
Copy link
Copy Markdown

utilmind commented Apr 1, 2017

And of course I detecting the device type and don't even loading jquery.sticky-kit.js for phones.

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

Successfully merging this pull request may close these issues.

6 participants