<style type="text/css">
.style1
{
width: 50%; //must to be dynamically change == e.pageX
height: 100%;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function () {
$(document).mousemove(function (e) {
$('.changes').val(e.pageX);
});
});
</script>
<asp:Image ID="Image1" runat="server" cssClass="changes style1" ImageUrl="~/8.jpg"/>
我如何使用 jquery 更改宽度:**%;在 style1 == e.pageX
图像宽度跟随鼠标,无需任何点击和页面重新加载。
最佳答案
jQuery(document).ready(function () {
$(document).mousemove(function (e) {
$('.changes').width(e.pageX);
});
});
关于jquery动态改变css样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12474928/