0
我有一個div有填充只有和我有另一個div沒有任何css屬性。
我想使用outerHeight
給兩個div使用相同的高度。如何將元素的高度複製到另一個元素?
這是我的測試,這工作,但不完全: http://jsfiddle.net/A2bNm/6/
$("#container").mouseenter(function() {
$("#top").animate({ 'padding' : 70 }, "slow");
$("#bottom").animate({'height':($("#top").outerHeight())}, "slow");
}).mouseleave(function() {
$("#top").animate({ 'padding' : 20}, "slow");
$("#bottom").animate({'height':($("#top").outerHeight())}, "slow");
});
能幫忙嗎?謝謝你,對不起我英文不好! :)
我試圖用'this'來引用我的div,但不起作用!你能給一個jsfiddle例子嗎?謝謝! – 2013-04-08 09:20:36
我指的是這個http://jsfiddle.net/A2bNm/7/作爲一種用法,沒有實際的完整實現。請注意,我正在選擇容器的子項,以便$(this)引用每個div。 – ericosg 2013-04-08 17:02:49
謝謝你veru多!但在div **#top **和**#bottom **我有其他的div,所以如果我使用'$(this)'這是指所有的div。我試圖將'this'更改爲id名稱,但不起作用。 – 2013-04-10 10:46:58