1 |
85ad3d82
|
Assos Assos
|
(function($) {
|
2 |
|
|
Drupal.behaviors.moduleFilterDynamicPosition = {
|
3 |
|
|
attach: function() {
|
4 |
|
|
$(window).scroll(function() {
|
5 |
|
|
|
6 |
|
|
var top = $('#module-filter-tabs').offset().top;
|
7 |
|
|
var bottom = top + $('#module-filter-tabs').height();
|
8 |
|
|
var windowHeight = $(window).height();
|
9 |
|
|
if (((bottom - windowHeight) > ($(window).scrollTop() - $('#module-filter-submit').height())) && $(window).scrollTop() + windowHeight - $('#module-filter-submit').height() - $('#all-tab').height() > top) {
|
10 |
|
|
$('#module-filter-submit').removeClass('fixed-top').addClass('fixed fixed-bottom');
|
11 |
|
|
}
|
12 |
|
|
else if (bottom < $(window).scrollTop()) {
|
13 |
|
|
$('#module-filter-submit').removeClass('fixed-bottom').addClass('fixed fixed-top');
|
14 |
|
|
}
|
15 |
|
|
else {
|
16 |
|
|
$('#module-filter-submit').removeClass('fixed fixed-bottom fixed-top');
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
if ($('#module-filter-submit').hasClass('fixed-bottom') || $('#module-filter-submit').hasClass('fixed-top')) {
|
21 |
|
|
var left = $('#module-filter-tabs').offset().left - $(window).scrollLeft();
|
22 |
|
|
if (left != $('#module-filter-submit').offset().left - $(window).scrollLeft()) {
|
23 |
|
|
$('#module-filter-submit').css('left', left);
|
24 |
|
|
}
|
25 |
|
|
}
|
26 |
|
|
});
|
27 |
|
|
$(window).trigger('scroll');
|
28 |
|
|
$(window).resize(function() {
|
29 |
|
|
$(window).trigger('scroll');
|
30 |
|
|
});
|
31 |
|
|
}
|
32 |
|
|
}
|
33 |
|
|
})(jQuery); |