| 1 |
(function($) { |
| 2 |
$(document).ready( function() { |
| 3 |
var product = $( '.bws_product_box' ), |
| 4 |
max = 0; |
| 5 |
$( product ).each( function () { |
| 6 |
if ( $( this ).height() > max ) |
| 7 |
max = $( this ).height(); |
| 8 |
}); |
| 9 |
$( '.bws_product_box' ).css( 'height', max + 'px' ); |
| 10 |
|
| 11 |
if ( $( '.bws-filter' ).length ) { |
| 12 |
var prvPos = $( '.bws-filter' ).offset().top; |
| 13 |
var maxPos = prvPos + $( '.bws-products' ).outerHeight() - $( '.bws-filter' ).outerHeight(); |
| 14 |
|
| 15 |
$( window ).scroll( function() { |
| 16 |
if ( $( window ).width() > 580 ) { |
| 17 |
var scrPos = Number( $( document ).scrollTop() ) + 40; |
| 18 |
if ( scrPos > maxPos ) { |
| 19 |
$( '.bws-filter' ).removeClass( 'bws_fixed' ); |
| 20 |
} else if ( scrPos > prvPos ) { |
| 21 |
$( '.bws-filter' ).addClass( 'bws_fixed' ); |
| 22 |
} else { |
| 23 |
$( '.bws-filter' ).removeClass( 'bws_fixed' ); |
| 24 |
} |
| 25 |
} |
| 26 |
}); |
| 27 |
} |
| 28 |
$( '.bws-menu-item-icon' ).click( function() { |
| 29 |
if ( $( this ).hasClass( 'bws-active' ) ) { |
| 30 |
$( this ).removeClass( 'bws-active' ); |
| 31 |
$( '.bws-nav-tab-wrapper, .bws-help-links-wrapper' ).hide(); |
| 32 |
} else { |
| 33 |
$( this ).addClass( 'bws-active' ); |
| 34 |
$( '.bws-nav-tab-wrapper, .bws-help-links-wrapper' ).css( 'display', 'inline-block' ); |
| 35 |
} |
| 36 |
}); |
| 37 |
$( '.bws-filter-top h2' ).click( function() { |
| 38 |
if ( $( '.bws-filter-top' ).hasClass( 'bws-opened' ) ) { |
| 39 |
$( '.bws-filter-top' ).removeClass( 'bws-opened' ); |
| 40 |
} else { |
| 41 |
$( '.bws-filter-top' ).addClass( 'bws-opened' ); |
| 42 |
} |
| 43 |
}); |
| 44 |
|
| 45 |
}); |
| 46 |
})(jQuery); |