![](/img/trans.png)
[英]How can I pass div height from JavaScript to CSS?
我想根據自己的高度將 position 設置為 div,這可能因內容而異。 這是結構: HTML CSS: ...
[英]How can I pass div height from JavaScript to CSS?
我想根據自己的高度將 position 設置為 div,這可能因內容而異。 這是結構: HTML CSS: ...
[英]element.offsetHeight does not work after defining with javascript
我試圖讓一個 div 的偏移高度,它應該是 25。 然后控制台說0,我不知道發生了什么,為什么會這樣。 請幫忙 PS。 'div' 是一個創建的元素。 ...
[英]Finding the height of an element and then using that value to set the height of another element
我正在使用反應,typescript 和順風。 我希望一個元素的高度與另一個元素的高度相匹配。 通常它會很簡單,但我有一個復雜的 div 結構,所以我不能以正常的方式來做。 我嘗試的是計算 offsetHeight 和 offsetTopHeight,並將第二個元素的高度設置為這個值。 代碼如下,但 ...
[英]How to smoothly scroll to an element via a hash in Nuxt?
所以我的目標是創建一個帶有 Nuxt.js 的錨鏈接菜單,該菜單滾動到用戶單擊的頁面部分,現在我有幾種不同的方法,但我不確定哪個是“正確的”。 選項1: 我創建了一個菜單,它獲取部分 div 的offsetTop以了解當用戶單擊菜單中的鏈接時滾動多遠,但我遇到的問題是 div 的值很少,例如off ...
[英]Cannot read property 'getBoundingClientRect' of null in Angular
我正在嘗試使用getBoundingClientRect().height或this.elementView.nativeElement.offsetHeight獲取此<div class="bundles-wrap enterprise"元素的像素高度。 這是我的 HTML: 這是我的 ...
[英]Is it possible to use querySelectorAll with offsetHeight?
我想知道是否可以使用 offsetHeight 獲得許多元素的高度 我想對'mouseover'上的.card__description 高度的.card__img 進行翻譯,是否可以使用querySelectorAll('.card__description).offsetHeight 並使用循 ...
[英]How could one sync the offsetHeight of a section to the current time via new Date?
我對 JavaScript 比較陌生,在過去的幾周里花了很多時間在日期和時間教程上,但是對於我的抽象時鍾項目,我根本無法弄清楚一件事:讓我的 div 的 offsetHeight 同步到當前時間(以秒為單位)。 我希望時鍾顯示當前時間(給或花幾分鍾,時間以 15 分鍾為增量以 .paragraph ...
[英]at max right scroll >— hide right part not left part
我想做一件簡單的事情:我有一個兩個卷軸網站,我想在右側滾動條最大時隱藏右側部分。 所以我用 但是當左側部分的滾動達到最大值時,右側部分被隱藏。 我能怎么做 ? 帶有精確問題的代碼筆: https : //codepen.io/marie-fran-oise-talbot/pen/LKeqBE ...
[英]Div always matching each others even when window/outer div change
我試圖根據最高的幻燈片匹配每張幻燈片的高度。 我看到我可以使用“offsetHeight”,但這是代碼加載時的一組高度。 當窗口/外部div改變時,我想讓它可以修復(我在外面使用flexbox) $(document).ready(function() { var offse ...
[英]how to get element height in Vue.js
我正在嘗試獲取元素的 offsetHeight 但我沒有定義。 有了這個,我得到了 html 集合,一切正常: 但是如果我添加.offsetHeight我就沒有定義了。 怎么了? ...
[英]D3 cannot read property offsetHeight of null
我剛剛初始化它的高度時, cannot read property 'offsetHeight' of null 。 這是我的代碼: ...
[英]Dynamically setting height of React rendered table in Firefox differs from Chrome
當前正在使用Webpack,webpack-dev-server,熱模塊重載,React Router,樣式化組件等在React項目上工作 我創建了一個Table組件,在其中嘗試根據父對象的高度動態確定要在Table中呈現的行數。 在Chrome中,這可以按預期工作,但是在Firefox ...
[英]JavaScript HTMLElement.offsetHeight is not measured IF rendered?
沒有真正的官方 JavaScript 文檔,但讓我們看看: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 關於 HTMLElement.offsetHeight 他們說: 通常,元素的 ...
[英]Angular - What other issues can cause offsetHeight to remain “0”?
我需要知道渲染元素的高度。 我不在乎元素是否報告它或者父級是否檢測到高度。 我一直在研究這個問題,第一個根本原因是 :host 元素必須設置其display:block並且我已經做到了。 (我在正確的水平上做到了嗎?) this.nativeElement將重要信息轉儲到 console.l ...
[英]Angular 2: Weird Behavior When Trying to Access Component's Height using ElementRef
我正在嘗試在 Angular2 中創建一個圖像滑塊,如下所示。 <nstr-slider> <nstr-slide src="image-1.jpg">Slide Caption #1</slide> <nstr-slide src="ima ...
[英]Javascript element offsetHeight returns returns 0 in for loop
我試圖動態獲取三列網格內子元素的高度。 當i是等於2或當i大於1(即,當有在循環內最小2個元件), offsetHeight正確返回呈現高度(I顯示在專用的呈現高度值$('#testheight')檢查元素。) 但是,當i等於1時,即使呈現的元素具有高度(通過PHP在子元素內部呈現的 ...
[英]Why does a parent's offsetHeight ignore its child's margin unless the parent has a border?
1)在簡單的父子關系中,內部子級通常會影響父級的outerHeight : outer1.offsetHeight == 18 2)如果給內部孩子一個margin ,則父母的outerHeight不變: outer2.offsetHeight == 18 3)如果給父 ...
[英]offsetHeight of table row/TR seems to be giving different value in IE11 when standard complaint mode is NOT switched on. Is this bug in IE11?
我有2個表,這些表並排保持相等的行數,以達到固定的第一列(左側的第一張表)和水平可滾動其余列(右側的第二張表)的要求。 在加載時,將根據行的這些表高度中的內容[label,image,textArea等]大小進行調整,以在左右對齊。 這是通過比較行的較高值offsetHeight並將其分 ...
[英]Does getting the offsetHeight of an element have a side effect?
在Bootstrap collapse的代碼中,在hide()方法中,我看到以下行: this.$element[dimension](this.$element[dimension]())[0].offsetHeight 我不明白.offsetHeight最后的意思是什么,除非它有 ...
[英]JavaScript - If statement using .offsetHeight not working
我是JavaScript新手,正在練習。 我正在嘗試顯示h1和p元素的組合高度,這些高度在div中具有“ test”的類名稱。 我查了各種各樣的東西,覺得自己真的很親密,但不能完全解決這個問題。 有人能幫忙嗎? HTML: JavaScript: ...