Recalculating offset from top
I have a function setup that detects the offset from the top -- it's working just fine on load, but when the orientation changes, it won't recalculate. I thought "orientationchange" covered that, but for some reason it doesn't force a new offset. Any help would be greatly appreciated (been testing this far too long :/).
- $(document).ready(function() {
- var menu_hdr = $("[id^=table-] .divwrap").offset().top,$window = $(window);
- var menu_end_check = $(".table tbody tr:nth-last-child(9)").offset().top,$window = $(window);
- $(window).on("scroll resize orientationchange", function stickymenu() {
- var y_scroll_pos = window.pageYOffset;
- var menu_header = menu_hdr;
- var menu_footer_check = menu_end_check;
- if((y_scroll_pos >= menu_header) && (y_scroll_pos < menu_footer_check)) {
- /* do stuff */
- }
- });
- });