0
我學習交互式圖像鞋面-了jQuery的CSS3和PHP腳本http://tympanus.net/codrops/2010/03/22/interactive-image-vamp-up-with-jquery-css3-and-php/jQuery的克隆項目
我的問題,如何使項目克隆並獲得克隆的位置?
在此先感謝
我學習交互式圖像鞋面-了jQuery的CSS3和PHP腳本http://tympanus.net/codrops/2010/03/22/interactive-image-vamp-up-with-jquery-css3-and-php/jQuery的克隆項目
我的問題,如何使項目克隆並獲得克隆的位置?
在此先感謝
var cloned = $("#itemtoclown").clone(); //clone an element
$("body").append(cloned); //Insert it into DOM
//Access the positions like with
var positions = cloned.position();
console.log(positions.top); //Access the top
爲了得到一些元素的位置必須附加到HTML DOM樹。否則,你會得到最高:和左:
$(document).ready(function(){
position = $('div:first').clone().appendTo(document.body).position();
alert('top:' + position.top + ' left: ' + position.left);
});
你在哪裏想到被插入克隆最終會真正的基礎上,你說過Starx有Depnds下面最好的猜測。 – Paystey 2012-04-20 11:35:02