|
|
|
@ -21,11 +21,26 @@ $(function () { |
|
|
|
|
}, 500) |
|
|
|
|
}, 2500) |
|
|
|
|
|
|
|
|
|
$('.block-collapse').on('click', (e) => { |
|
|
|
|
$(e.target).closest('.block-collapse').addClass('reveal') |
|
|
|
|
}).on('dblclick', (e) => { |
|
|
|
|
$(e.target).closest('.block-collapse').removeClass('reveal') |
|
|
|
|
}); |
|
|
|
|
// toggle collapse when clicked outside link, without drag
|
|
|
|
|
$('.block-collapse') |
|
|
|
|
.on('mousedown', (e) => { |
|
|
|
|
let $bc = $(e.target).closest('.block-collapse') |
|
|
|
|
$bc.data('mx', e.screenX); |
|
|
|
|
$bc.data('my', e.screenY); |
|
|
|
|
}) |
|
|
|
|
.on('mouseup', (e) => { |
|
|
|
|
if (e.target.nodeName === 'A') return |
|
|
|
|
let $bc = $(e.target).closest('.block-collapse') |
|
|
|
|
if (typeof $bc.data('mx') !== 'undefined') { |
|
|
|
|
let x0 = +$bc.data('mx'); |
|
|
|
|
let y0 = +$bc.data('my'); |
|
|
|
|
if (Math.abs(x0 - e.screenX) > 5 || Math.abs(y0 - e.screenY) > 5) { |
|
|
|
|
// drag
|
|
|
|
|
} else { |
|
|
|
|
$(e.target).closest('.block-collapse').toggleClass('reveal') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// auto-alias
|
|
|
|
|