0
我有一些類似下面的代碼,創建一個按照屏幕大小連續變化的按鈕(因爲「img-responsive」)。如何輕鬆獲取當前引導響應按鈕的大小?
<a class="btn btn-primary btn-lg btn-block img-responsive" id="btntest" href="#" role="button" onclick="showWidth()">{{button.label}}</a>
我在屏幕上有另一個元素,我想強制與任意按鈕大小相同的大小。我需要確定按鈕大小並將其他元素的大小設置爲相同。我已經嘗試了下面作爲開始獲取大小,但它只是顯示一個空字符串。有任何想法嗎?
//in css file
#btntest{display : inline-block;}
~~~~~~~
//in angular controller
showWidth = function() {
var e = document.getElementById("btntest");
console.log(e.style.width);
}