- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
$( '.video', tl ).each( function() {
if( this.id !== target ) {
// get other objects props
var snaper = $(this);
var left = getLeft( snaper );
var swidth = snaper.width();
// calculate snap positions
var leftSpan = left + swidth;
var rightSnap = cPos + swidth;
// if snap performed
if( cPos === leftSpan || rightSnap === left ) {
var mouse = getMouse( event, floater );
var shift = 5;
// if cursor goes out snaped object
if( shift === ( -1 * mouse ) || mouse === shift + swidth ) {
// difference in sizes
var diff = ( (fwidth - swidth) > 0 ) ? fwidth - swidth : swidth - fwidth;
// setup new positions
var fl = getLeft( floater );
var sl = getLeft( snaper );
// fix smaller position
if( fwidth > swidth ) {
fl += diff;
} else {
sl += diff;
}
// apply overlay to prevent blinking "dragable"
var overlay = $('<div id="overlay"></div>');
$('body').append(overlay);
$('#overlay').focus();
// reverse animation dock object
snaper.animate({'left': fl}, 1000);
// reverse animation floater
floater.animate({'left': sl}, 1000,
function(){
// unset overlay
$('#overlay').remove();
// return focus to floater object
floater.focus();
});
}
}
}
});