JQuery基础
实现浮动层效果
代码示例:
<script type="text/javascript">
$("img").mouseenter(function (e)//用e得到鼠标状态 {
$("#username").text($(this).val());
$("#divDetails").css("top", e.pageY).css("left", e.pageX).show("slow");
}
</script>
<div style="display:none; background-color:Blue; position:absolute; border-style:dotted; border-bottom-width:1px;"; id="divDetails"; >
<p >姓名: <span id="username"></span></p>
代码示例:
<script type="text/javascript">
$("img").mouseenter(function (e)//用e得到鼠标状态 {
$("#username").text($(this).val());
$("#divDetails").css("top", e.pageY).css("left", e.pageX).show("slow");
}
</script>
<div style="display:none; background-color:Blue; position:absolute; border-style:dotted; border-bottom-width:1px;"; id="divDetails"; >
<p >姓名: <span id="username"></span></p>
图片动态变化效果:
$("img").click(function () { $(this).animate({ "width": "300", "height": "300" }, "slow"); });