如何在mouseover上从右向左滑动td,在mouseout上向后滑动
How to slide a td from right to left on mouseover and slide back on mouseout
我有一个html页面,它被分为单行和两列。第一列的宽度为90%,第二列为10%。
当页面加载时,我希望第二列应该完全隐藏,在整个页面上应该有第一列的内容。
但当我把鼠标移向右侧那10%的页面时。td的内容应该是滑动的,当我移出鼠标时,它应该向后滑动(隐藏)到右边。
我正在努力做到这一点:
$(document).ready(function() {
document.getElementById("map-canvas").style.height = document.body.clientHeight + 'px';
$( "#side" ).mouseover(function() {
document.getElementById("map-canvas").className = "OverlayEffect";
$( "#map-canvas" ).animate({
width: "100%"
});
});
$( "#side" ).mouseout(function() {
$( "#map-canvas" ).animate({
width: "90%"
});
});
});
Html:
<table width="100%">
<tr>
<td width="90%" id="map">
<!-- start Loading Fancy Box handling -->
<div id="modalMsg">
<br /> <br /> <imgsrc="../DiagnosticDrop4/static/images/ajax-loader.gif" /> <br /> <br />
</div>
<!-- end Loading Fancy Box handling -->
<div id="map-canvas"></div>
</td>
<td width="10%" class="Sidebar" id="side">
<div id="map-canvas1">
<a id='link' href='../DiagnosticDrop4/san.html'>
<h3>
<center>Add/Delete SAN</center>
</a>
</div>
<div id="map-canvas2">
<a id='alink' href='../DiagnosticDrop4/ParamIntervalDetails'>
<h3>
<center>24hr Dashboard</center>
</a>
</div>
</td>
</tr>
</table>
试试这个代码,我让它按照你想要的方式工作到
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function() {
$( "#side" ).hide();
$("body").on("mousemove",function(event) {
if (event.pageX >= $( document ).width() - 50) {
$( "#map" ).width('0%');
$( "#side" ).width('100%');
$( "#side" ).show();
}
else
{
$( "#map" ).width('100%');
$( "#side" ).width('0%');
$( "#side" ).hide();
}
});
});
</script>
</head>
<body>
<table width="100%" border="1">
<tr>
<td width="90%" id="map">
<!-- start Loading Fancy Box handling -->
<div id="modalMsg">
<br /> <br /> <imgsrc="../DiagnosticDrop4/static/images/ajax-loader.gif" /> <br /> <br />
</div> <!-- end Loading Fancy Box handling -->
<div id="map-canvas">
</div>
</td>
<td width="10%" class="Sidebar" id="side">
<div id="map-canvas1">
<a id='link' href='../DiagnosticDrop4/san.html'><h3>
<center>Add/Delete SAN</center></a>
</div>
<div id="map-canvas2">
<a id='alink' href='../DiagnosticDrop4/ParamIntervalDetails'><h3>
<center>24hr Dashboard</center></a>
</div>
</td>
</tr>
</table>
</body>
</html>
相关文章:
- 音频控件在mouseover上显示,在mouseout上淡出
- 正在获取生成的PHP td值
- 如何在td元素中添加监听器
- 如何首先设置样式<td>表中包含在窗体中的元素
- 使用javascript获取表的td值
- tu如何将id放在填充了json数据的html表td上
- 改变所有<td>为特定的桌子点击颜色
- Gridview ImageButton更改mouseover和mouseout上的图像
- JQuery展开和隐藏表td
- jQuery如何获取td单元格值
- d3防止在上下文菜单上触发mouseout
- 如何调用表td标记内的Onload函数
- 使用谷歌地图api计算距离并将其设置在表格中<td>
- 查找所有TD标签并读取其数据属性
- 在同一tr-jQuery中获取td的值
- jQuery将td onclick值传递到其他表
- 计算HTML表TD中两个数字之间的百分比
- 使用querySelector()获取最后一个td元素
- <td> focusin event .addclass
- 如何在mouseover上从右向左滑动td,在mouseout上向后滑动