Created
February 4, 2016 06:04
-
-
Save MkShaman/a12703e8516d19afa832 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var s = $(".catalog_filter > form"); | |
| var pos = s.offset(); | |
| var $catalogR = $('.catalog .catalog_right'); | |
| var item = $catalogR.find('.item'); | |
| $(window).scroll(function() { | |
| var HCatalog = $catalogR.height(); | |
| var marginItem = item.outerHeight(true) - item.height(); | |
| var FilterH = $('.catalog_filter').height((HCatalog-marginItem-$catalogR.find('nav.pageNav').outerHeight(true))+'px'); | |
| /*bottom*/ | |
| var topCat = $catalogR.offset(); | |
| var bottom = Math.abs(Math.abs(Math.abs($(window).height() - topCat.top) - Math.abs($catalogR.height()-$catalogR.find('nav.pageNav').outerHeight(true))) - marginItem); | |
| // var topFilt = $('.catalog_filter').offset(); | |
| // var bottom = Math.abs(($('.catalog_filter').outerHeight(true)+topFilt.top)-s.height()-10); | |
| // alert(bottom); | |
| var windowpos = $(window).scrollTop(); | |
| // $(".catalog_filter > form .title").html(windowpos+' dd '+bottom); | |
| if (windowpos >= pos.top ) { | |
| s.addClass("stick"); | |
| s.removeClass("pos-bottom"); | |
| if (windowpos >= bottom) { | |
| s.removeClass("stick"); | |
| s.addClass('pos-bottom'); | |
| } | |
| } else { | |
| s.removeClass("stick"); | |
| s.removeClass("pos-bottom"); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment