-
-
Save zeekhan90/0ac769f0b3af0e795f1725ce694376ec to your computer and use it in GitHub Desktop.
jQuery flyTo(sFrom, sTo, sTime)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TO-DO: Remember to add URL | |
function flyTo(sFrom, sTo, sTime) { | |
sTime = (sTime || 2000); | |
var $from = jQuery(sFrom).clone().appendTo($('body')); | |
var $to = jQuery(sTo); | |
var fromOffset = $from.offset(); | |
var toOffset = $to.offset(); | |
$from.css({ | |
'position': 'absolute', | |
'left': fromOffset.left + 'px', | |
'top': fromOffset.top + 'px', | |
'z-index': 100 | |
}); | |
console.log(fromOffset.left + 'px', fromOffset.top + 'px') | |
$from.animate({ | |
'position': 'absolute', | |
'left': toOffset.left + 'px', | |
'top': toOffset.top + 'px', | |
'z-index': 100, | |
'width': '10px', | |
'height': '10px', | |
'opacity': 0 | |
}, sTime, function() { | |
jQuery(this).remove(); | |
}); | |
} | |
flyTo('.borderit:first', '#wishListLink'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment