dio-v
4/7/2016 - 6:17 AM

show border of one item fly to other item

show border of one item fly to other item

function flyto(el1,el2,vTime,f){
	var el1x = $(el1).offset().left;
	var el1y = $(el1).offset().top;
	var el1w = $(el1).outerWidth();
	var el1h = $(el1).outerHeight();	
	var el2x = $(el2).offset().left;
	var el2y = $(el2).offset().top;
	var el2w = $(el2).outerWidth();
	var el2h = $(el2).outerHeight();		
	$('body').prepend('<div id="flytodiv" style="border:solid 1px #000;z-index:9999;position:absolute;left:'+el1x+'px;top:'+el1y+'px;width:'+el1w+'px;height:'+el1h+'px;"></div>');
	$('#flytodiv').animate({left:el2x+'px',top:el2y+'px',width:el2w+'px',height:el2h+'px',opacity:0.2},vTime).fadeOut(function(){$(this).remove()},function(){
		 if(typeof f == "function") f();			
	});
}
function flyto(el1, el2, vTime, f) {
    var el1x = el1.offset().left;
    var el1y = el1.offset().top;
    var el1w = el1.outerWidth();
    var el1h = el1.outerHeight();
    var el2x = el2.offset().left;
    var el2y = el2.offset().top;
    var el2w = el2.outerWidth();
    var el2h = el2.outerHeight();
    $('body').prepend('<div id="flytodiv" style="border:solid 1px #000;z-index:9999;position:absolute;left:' + el1x + 'px;top:' + el1y + 'px;width:' + el1w + 'px;height:' + el1h + 'px;"></div>');
    $('#flytodiv').animate({ left: el2x + 'px', top: el2y + 'px', width: el2w + 'px', height: el2h + 'px', opacity: 0.2 }, vTime).fadeOut(function () { $(this).remove() }, function () {
        if (typeof f == "function") f();
    });
}