-
AuthorPosts
-
doorknob Friend
doorknob
- Join date:
- December 2013
- Posts:
- 36
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 2
- Thanked:
- 20 times in 1 posts
February 2, 2014 at 8:27 pm #194405Hi,
I have a responsive template design that uses sticky menus. I’m using the StickUp jQuery plugin which auto detects how far down the page the menu bar is positioned and all works ok. However, if the browser is resized and the page switches to a different format (e.g. large to medium), I need to reinitialise the plugin so that the new top margin can be stored. How can I run a js function when t3 switches from one page size to another?
Thanks
PhilWall Crasher DeveloperWall Crasher
- Join date:
- December 2011
- Posts:
- 1113
- Downloads:
- 0
- Uploads:
- 15
- Thanks:
- 66
- Thanked:
- 361 times in 300 posts
February 3, 2014 at 4:38 am #520891Hi doorknob,
There was no actual event for this.
You should listen to window resize event and check for the break point value.
The break point should be @navbarCollapseWidth in bootstrap 2 and @grid-float-breakpoint in bootstrap 3.1 user says Thank You to Wall Crasher for this useful post
doorknob Frienddoorknob
- Join date:
- December 2013
- Posts:
- 36
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 2
- Thanked:
- 20 times in 1 posts
February 3, 2014 at 12:01 pm #520936Thanks Wall Crasher,
That’s very helpful. I’m now having trouble getting access to the Bootstrap variable in JS. Any ideas on that?
PhilWall Crasher DeveloperWall Crasher
- Join date:
- December 2011
- Posts:
- 1113
- Downloads:
- 0
- Uploads:
- 15
- Thanks:
- 66
- Thanked:
- 361 times in 300 posts
February 4, 2014 at 2:05 am #521029@ doorknob,
I am afraid there was no official way to do it.
To make it easy, just use hardcode value (it is 767).
For a tweak, you can detect for the collapse menu button to see if they are visible (you can put another piece of html markup to detect the visibility of this breakpoint).
doorknob Frienddoorknob
- Join date:
- December 2013
- Posts:
- 36
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 2
- Thanked:
- 20 times in 1 posts
February 4, 2014 at 2:12 pm #521123Thanks Wall Crasher,
I did it by testing the header for visibility and it works fine. Although I would have preferred a more generic solution, I think using css is, in some ways, a better approach than using the breakpoint value directly because there seems to be minor variations in the interpretation of width from browser to browser depending on whether you check $(window), $(document) or $(‘html’) and using css means that interpreting the breakpoint into a screen size gives bettter consistency because it is only ever done in one place.
Thanks again
Phil -
AuthorPosts
This topic contains 5 replies, has 2 voices, and was last updated by doorknob 10 years, 9 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum