鼠标移动到图片上时,显示大图片
2014-05-07 17:01
253 查看
HTML标签中的一部分,仅供参考
<tr>
<td><input type="checkbox" class="checkbox1"/></td>
<td>1002</td>
<td>小猫咪</td>
<td><img src="img/02.jpg" height="100" width="100" alt=""/></td> //图片
<td>200</td>
<td><input type="button" value="添加"/></td>
</tr>
<img id="imgTip" class="clsImg" src="img/04.jpg" alt="" /> //写在外面,隐藏显示,定位提示图片的位置
.clsImg{
position:absolute;
border:1px solid #ccc;
width:200px;
height:200px;
display:none;
}
JS部分实现功能:
<script type="text/javascript" src="../jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function(){
$("table tr:nth-child(odd)").css("background","#CCF"); //奇偶行变色
var x=5; var y=15;
$("table tr td img").mousemove(function(e) {
$("#imgTip").attr("src",this.src).css({"top":(e.pageY+y)+"px","left":(e.pageX+x)+"px"}).show(600);
});
$("table tr td img").mouseout(function() {
$("#imgTip").hide();
});
/*复选框单机事件*/
$("#checkAll").click(function() {
if(this.checked){
$("table tr td input[type=checkbox]").attr("checked",true);
}else
{
$("table tr td input[type=checkbox]").attr("checked",false);
}
});
});
</script>
<tr>
<td><input type="checkbox" class="checkbox1"/></td>
<td>1002</td>
<td>小猫咪</td>
<td><img src="img/02.jpg" height="100" width="100" alt=""/></td> //图片
<td>200</td>
<td><input type="button" value="添加"/></td>
</tr>
<img id="imgTip" class="clsImg" src="img/04.jpg" alt="" /> //写在外面,隐藏显示,定位提示图片的位置
.clsImg{
position:absolute;
border:1px solid #ccc;
width:200px;
height:200px;
display:none;
}
JS部分实现功能:
<script type="text/javascript" src="../jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function(){
$("table tr:nth-child(odd)").css("background","#CCF"); //奇偶行变色
var x=5; var y=15;
$("table tr td img").mousemove(function(e) {
$("#imgTip").attr("src",this.src).css({"top":(e.pageY+y)+"px","left":(e.pageX+x)+"px"}).show(600);
});
$("table tr td img").mouseout(function() {
$("#imgTip").hide();
});
/*复选框单机事件*/
$("#checkAll").click(function() {
if(this.checked){
$("table tr td input[type=checkbox]").attr("checked",true);
}else
{
$("table tr td input[type=checkbox]").attr("checked",false);
}
});
});
</script>
相关文章推荐
- 当鼠标移动到图片上时,跟随鼠标显示放大的图片
- 当鼠标移动到图片上会显示 不同的背景
- 鼠标移动到图片名上,显示图片----js研究(1)
- AJAX练习3--鼠标移动到指定的图片显示相应的该图片的信息
- js 鼠标移动显示图片的简单实例
- JQuery实现鼠标移动图片显示描述层的方法
- 一张图片由A、B两部分组成,当鼠标移动上去时显示B部分,当鼠标移出时显示A部分。
- 2张图片叠放,根据鼠标的移动来显示
- js鼠标移动在title中显示图片的效果代码
- js 鼠标移动显示图片
- 鼠标在文本上移动时层的显示与消失(以及层里显示图片)ASP.NET
- js 鼠标移动显示图片的简单实例
- JS实现鼠标移动到缩略图显示大图的图片放大效果
- js鼠标移动到图片上浮动层显示图片
- 当鼠标移动到图片上时跟随鼠标显示放大的图片效果
- jsp中,当鼠标移动到图片上时,显示该图片的大图
- 鼠标移动到图片名上,显示图片的简单实例
- 用CSS设置当鼠标移动到图片内时显示文字
- MFC实现当鼠标移动到button按钮上时是显示一张图片,移开显示另外一张,点击是显示另外一张
- 鼠标移动到图片上显示阴影和图片上的文字