HTML文檔具有一些HTML元素,如div,p,img,...HTML-Element帶「z-index」或「append」?
大多數都是動態創建的(如果有幫助的css:「position:absolute;」)。
每次在OnClick之後,元素都必須到達其他元素的前面。
我的意思是:
element.parentNode.appendChild(element);
or
element.parent().append(element);
或
// E.g. with css as follows:
$('#ObjId').css('z-index', HighestIndx+1);
我更喜歡使用appendChild
,由於CSS樣式z-index
不會被插入的元素。 但我不知道appendChild
與z-index
的選擇是否會更好。
我的問題:使用z-index或append/appendChild有什麼更好? 謝謝。
沒錯。但它也可以用來把對象帶到別人面前。但現在我認爲,使用z-index會更好[另一個鏈接](http://stackoverflow.com/questions/3233219/is-there-a-way-in-jquery-to-bring-a- DIV至前)。 – user3815508 2014-10-18 21:53:01