author | ymh <ymh.work@gmail.com> |
Tue, 27 Sep 2022 16:37:53 +0200 | |
changeset 19 | 3d72ae0968f4 |
parent 12 | d8a8807227e4 |
permissions | -rwxr-xr-x |
5 | 1 |
(function($) { |
19 | 2 |
"use strict"; |
3 |
$( document ).ready( |
|
4 |
function() { |
|
5 |
var product = $( '.bws_product_box' ), |
|
6 |
max = 0; |
|
7 |
$( product ).each( |
|
8 |
function () { |
|
9 |
if ( $( this ).height() > max ) { |
|
10 |
max = $( this ).height(); |
|
11 |
} |
|
12 |
} |
|
13 |
); |
|
14 |
$( '.bws_product_box' ).css( 'height', max + 'px' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
15 |
|
19 | 16 |
if ( $( '.bws-filter' ).length ) { |
17 |
var prvPos = $( '.bws-filter' ).offset().top; |
|
18 |
var maxPos = prvPos + $( '.bws-products' ).outerHeight() - $( '.bws-filter' ).outerHeight(); |
|
5 | 19 |
|
19 | 20 |
$( window ).scroll( |
21 |
function() { |
|
22 |
if ( $( window ).width() > 580 ) { |
|
23 |
var scrPos = Number( $( document ).scrollTop() ) + 40; |
|
24 |
if ( scrPos > maxPos ) { |
|
25 |
$( '.bws-filter' ).removeClass( 'bws_fixed' ); |
|
26 |
} else if ( scrPos > prvPos ) { |
|
27 |
$( '.bws-filter' ).addClass( 'bws_fixed' ); |
|
28 |
} else { |
|
29 |
$( '.bws-filter' ).removeClass( 'bws_fixed' ); |
|
30 |
} |
|
31 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
} |
19 | 33 |
); |
34 |
} |
|
35 |
$( '.bws-menu-item-icon' ).click( |
|
36 |
function() { |
|
37 |
if ( $( this ).hasClass( 'bws-active' ) ) { |
|
38 |
$( this ).removeClass( 'bws-active' ); |
|
39 |
$( '.bws-nav-tab-wrapper, .bws-help-links-wrapper' ).hide(); |
|
40 |
} else { |
|
41 |
$( this ).addClass( 'bws-active' ); |
|
42 |
$( '.bws-nav-tab-wrapper, .bws-help-links-wrapper' ).css( 'display', 'inline-block' ); |
|
43 |
} |
|
44 |
} |
|
45 |
); |
|
46 |
$( '.bws-filter-top h2' ).click( |
|
47 |
function() { |
|
48 |
if ( $( '.bws-filter-top' ).hasClass( 'bws-opened' ) ) { |
|
49 |
$( '.bws-filter-top' ).removeClass( 'bws-opened' ); |
|
50 |
} else { |
|
51 |
$( '.bws-filter-top' ).addClass( 'bws-opened' ); |
|
52 |
} |
|
53 |
} |
|
54 |
); |
|
55 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
} |
19 | 57 |
); |
58 |
})( jQuery ); |