【发布时间】:2016-02-23 11:21:20
【问题描述】:
我正在尝试使用范围输入更改子元素的位置(根据文本具有不同的高度),一旦子 div 触及具有固定高度的父元素的底部,我想停止应用顶部位置。
$('#change_position').on('input', function () {
var val = +$(this).val(),
ScrSize = parseInt($('.screen').css('height')),
Stop = $('.screentip').offset().top,
h = parseInt($('.screentip').css('height')),
tofsset = Stop - h;
if (tofsset < ScrSize) {
$('.screentip').css('top', val + "%");
}
});
【问题讨论】:
标签: javascript jquery html css