|
|
@ -21,11 +21,26 @@ $(function () { |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
}, 2500) |
|
|
|
}, 2500) |
|
|
|
|
|
|
|
|
|
|
|
$('.block-collapse').on('click', (e) => { |
|
|
|
// toggle collapse when clicked outside link, without drag
|
|
|
|
$(e.target).closest('.block-collapse').addClass('reveal') |
|
|
|
$('.block-collapse') |
|
|
|
}).on('dblclick', (e) => { |
|
|
|
.on('mousedown', (e) => { |
|
|
|
$(e.target).closest('.block-collapse').removeClass('reveal') |
|
|
|
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
|
|
|
|
// auto-alias
|
|
|
|