我正在做一个简单的悬停滚动条项目。当有人通过prepend(),append(),html()
等更改html标签中的内容时,我想更改拇指的高度。我怎样才能做到这一点?我用Google搜索并找到了像
$('.class').html('value').trigger(somefunction())
但这不是答案。因为我不是其他js代码的开发者。我只想用我的脚本文件来做这件事。
答案 0 :(得分:1)
以下是这样做的方法,您可以使用DOMSubtreeModified
个事件。但请注意It before using it.
$("body").on('DOMSubtreeModified', ".myCLASS", function() {
alert($(this).html());
});
setTimeout(function(){ $(".myCLASS").html("my Test") }, 3000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="myCLASS"></div>