0
A
回答
2
.hide()
它像添加display:none
到CSS。它不會影響項目的高度或寬度
0
.hide()
不會更改元素的尺寸。當您說.show()
時,它將與隱藏之前的尺寸相同。
0
我認爲jQuery只是設置display:none
來隱藏div。
0
element.hide()只是將樣式更改爲'display:none'。它不會對高度和/或寬度做任何事情。有關更多信息,請參閱。使用element.show()會將'display'樣式屬性重置爲之前的樣式。
0
hide()
和show()
存儲display
屬性,並在display: none
和以前存儲的值之間更改。因此,它不會更改元素的width
或height
。
2
不,它很容易測試:
HTML:
<div id="test1"></div>
<div id="test2">Testing</div>
CSS:
#test1 {
height: 40px;
width: 40px;
}
JS:
$('div').hide();
console.log($('#test1').height()); //returns 40
console.log($('#test2').height()); //returns 20
相關問題
- 1. jQuery .width()和.height()奇怪的行爲
- 2. Jquery; Chrome Image Width and Height = 0 for new Image()
- 3. android - calculateInSampleSize,爲什麼Math.round在width> height時處理height(height/reqHeight)?
- 4. 使用jQuery的width()和height()方法
- 5. JS「Window」width-height vs「screen」width-height?
- 6. 如何使用Width和Height反映ScaleTransform以及如何通過設置Height和Width來ScaleTransform?
- 7. jquery height returns 0
- 8. WPF:在沒有文本時將TextBlock Height設置爲0
- 9. 設置.height()嵌套的jQuery永遠在IE中,但不是鉻
- 10. NSAttributedString height由width和numberOfLines限制
- 11. 圖不服從width和height屬性
- 12. 將Chart.ChartAreas [0] .Axes [0] .Maximum設置爲「Auto」時,是否存在System.Windows.Forms.DataVisualization.Charting.Chart的缺陷?
- 13. jQuery - .width()在最大高度爲imgs時返回0
- 14. TImage width/height anchor not working
- 15. Java applet with getSize()。width,getSize()。height
- 16. ImageButton:Force square icon(height = WRAP_CONTENT,width =?)
- 17. Interface Builder中的「Width equal height」約束
- 18. 當使用IF和UN將未知值設置爲0時,有時在rrd圖中最後的值變爲0
- 19. 爲什麼max-height在DIV上的行爲與max-width不同?
- 20. IE 0.width爲空或不是對象
- 21. PHP當display_errors在AJAX響應中設置爲0 500時
- 22. MySQL語句總是將值設置爲0當更新設置
- 23. 爲什麼當頁面刷新爲chrome時,width的值被設置爲零?
- 24. 你是否需要在.NET中設置Response.Status和Response.StatusCode?
- 25. 爲什麼在窗口調整大小時,CSS「height」的行爲不像「width」?
- 26. 當你將它設置爲一個jQuery集時,理解function.apply中的「this」arg
- 27. WCFstreaming問題,當設置位置爲0
- 28. get image WIDTH和HEIGHT併爲任何圖像寫屬性
- 29. jquery .height和.width在ajax-ed內容上返回錯誤的數字
- 30. img元素上的HTML width/height屬性和CSS width/height屬性有什麼區別?
棘手的問題,儘管高度和寬度並未隱式更改,但嘗試從隱藏父級和瀏覽器有問題的元素獲取維度 – charlietfl 2012-03-01 00:40:50