Проблема в том, что свойство height
будет возвращать значение в пикселях :
$('.some.thing').click(function() {
console.log($(this).css('height'));
});
div { background: red }
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<div class='some thing'>stuff</div>
16 пикселей эквивалентны одному em, поэтому просто замените ваше условие 3em
на 48px
:
$('.some.thing').click(function() {
if ($(this).css('height') === '48px') {
$(this).css('height', '10em');
} else {
$(this).css('height', '3em');
}
});
div { background: red }
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<div class='some thing'>stuff</div>
Вы видите функцию Java 1.5 varargs. Под капотами его просто массив с синтаксическим sugaring.