как перевести это значение в em
Чем отличается line-height = 1em от line-height = 1
function constrain(n, low, high) {
return Math.max(Math.min(n, high), low);
}
let padding = 218;
let wrapperRect = $wrapper[0].getBoundingClientRect();
let offset = parseInt($nav.attr("data-sticky-offset"));
if (wrapperRect.top < offset) {
let y = constrain(window.pageYOffset, 0, $target.height() - $nav.height() + $target.offset().top - offset);
$nav.addClass("is-floating");
if (y === $target.height() - $nav.height() + $target.offset().top - offset) {
$nav.addClass("on-end-point");
}
else {
$nav.removeClass("on-end-point");
}
$nav.css({
width: $nav.parent().width() + "px"
});
}
else {
$nav.removeClass("is-floating");
$nav.attr("style", "");
}
sec6 section img{
background: url(/images/157195/kvadratikshema1.png#size_98x98) center no-repeat;
padding: 98px;
}
<input type="text" name="city" value="" id="input-city" />
<ul>
<li data-value="Город 1" class="js-item">
<a href="#">Город 1</a>
</li>
<li data-value="Город 2" class="js-item">
<a href="#">Город 2</a>
</li>
<li data-value="Город 3" class="js-item">
<a href="#">Город 3</a>
</li>
</ul>
const inp_city = document.querySelector('#input-city');
const li_item = document.querySelectorAll('.js-item');
for (let i = 0;i < li_item.length;i = i + 1) {
li_item[i].addEventListener('click',function () {
inp_city.value = this.dataset.value;
}, false)
}
$('li').click(function(e) {
e.preventDefault();
let text = $(this).attr('data-value')
$('input').val(text)
})
$('li').click(function(e) {
e.preventDefault();
let text = $(this).find('a').text();
$('input').val(text)
})