1

heightスケーリングされた要素の実際の値を取得することは可能ですか?

transform: scale(...);

次のことを試しましたが、元に戻っていますheight

$('element').css('height');  // 16px (demo)

$('element').height(); // 21px (demo)

デモ: http://jsfiddle.net/ZvzXJ/

4

2 に答える 2

-1

以下のコードを使用して、スケーリングされた変換された要素の実際の高さを取得します。[ jsFiddle]

「高さ」の代わりにユーザー「outerHeight」

http://jsfiddle.net/ZvzXJ/8/

//full code here

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>

<style>
.button{
    -webkit-transform: scale( 3 );
    margin:100px;
    display:block;
}
</style>

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function($) {
    $(window).load(function(){
         alert($('.button').outerHeight()+ 'px');
         alert($('.button').css('height'));
    });   
});
</script>

</head>

<body>
<button class="button">Welcome</button>
</body>
</html>
于 2013-08-05T09:18:14.467 に答える