列表左边左右固定,右边可以左右滚动,且左右两边列表滚动时上下联动

function funcsrcoll1()
{
rightdiv.scrollTop = leftdiv.scrollTop;//设置左边的div和右边div上下滚动距离相同,即左右上下滚动联动。
}
function funcsrcoll2()
{
leftdiv.scrollTop = rightdiv.scrollTop;//设置左边的div和右边div上下滚动距离相同,即左右上下滚动联动。
Divtop.scrollLeft = rightdiv.scrollLeft;//设置左边的div和右边div左右滚动距离相同,即左右滚动联动。
}
function funcsrcoll3()
{
rightdiv.scrollLeft =Divtop.scrollLeft;//设置左边的div和右边div左右滚动距离相同,即左右滚动联动。
}

 

<body style="scroll: no">
<form method="post" id="form1" name="form1">
<div style="width: 200px; height: 443px; float: left; overflow: hidden;">
<div id="leftdiv" style="width: 220px; height: 423px; overflow-y: auto; overflow-x: hidden;"
onscroll="funcsrcoll1()">
<div id="divMenu" style="position: fixed; margin-top: 0px; width: 200px; height: 423px;">
<table cellpadding="0" cellspacing="1" width="100%" border="0" class="Table_List">
<tr class="ListTableHeader">
<td width="110px" nowrap="nowrap" align="center">
部门
</td>
<td width="90px" nowrap="nowrap" align="center">
下属部门
</td>
</tr>
</table>
</div>
<table cellpadding="0" cellspacing="1" width="100%" border="0" class="Table_List">
</table>
</div>
</div>
<div id="menudiv" style="width: 80%; height: 23px;margin-left:100px; margin-top: 0px; overflow: hidden;">
<div id="Divtop" style="width: 100%; height: 43px; overflow-x: auto; overflow-y: hidden;"
onscroll="funcsrcoll3()">
<script type="text/javascript">
window.onload = function() {
var width = $("#menudiv").width();
$("#menudiv").width(width - 20);
$("#Divtop").width(width);
}
</script>
<div id="divMain" style="margin-left:0px; width: 100%; height: 100%;" >
<table cellpadding="0" cellspacing="1" width="150%" border="0" class="Table_List">
<tr class="ListTableHeader">
<td width="10%" nowrap="nowrap" align="center">
有效
</td>
<td width="10%" nowrap="nowrap" align="center">
暂缓
</td>
<td width="10%" nowrap="nowrap" align="center">
未知
</td>
<td width="8%" nowrap="nowrap" align="center">
我租
</td>
<td width="8%" nowrap="nowrap" align="center">
他租
</td>
<td width="8%" nowrap="nowrap" align="center">
我售
</td>
<td width="8%" nowrap="nowrap" align="center">
他售
</td>
<td width="8%" nowrap="nowrap" align="center">
撤单
</td>
<td width="8%" nowrap="nowrap" align="center">
电话错误
</td>
<td width="8%" nowrap="nowrap" align="center">
待确认
</td>
<td width="10%" nowrap="nowrap" align="center">
已驳回
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="rightdiv" style="width: 80%; height: 420px; float: left; overflow: scroll"
onscroll="funcsrcoll2()">
<div id="divinner" style="float:left; width: 100%;">
<script type="text/javascript">
window.onload = function() {
var width = $("#menudiv").width();
$("#rightdiv").width(width + 20);
$("#divinner").width(width);
}
</script>
<table cellpadding="0" cellspacing="1" width="150%" border="0" class="Table_List">
</table>
</div>
</div>
</form>
</body>
</html>

 

转载于:https://www.cnblogs.com/wuchaofan1993/p/5993900.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
swiperjs是一个非常流行的移动端轮播插件,可以用来实现左右联动和上下滚动的效果。 要实现左右联动上下滚动,我们首先需要在HTML中创建相应的结构。可以使用一个外层容器来包裹两个swiper实例,一个用来实现左右联动,另一个用来实现上下滚动。 设置左右联动的swiper实例,需要设置"direction"为"horizontal",并设置相应的宽度。可以使用CSS来控制外层容器的宽度和高度。 设置上下滚动的swiper实例,需要设置"direction"为"vertical",并设置相应的高度。可以使用CSS来控制swiper的高度和样式。 在JavaScript中,我们需要初始化两个swiper实例,并设置它们的参数。可以通过"Swiper"构造函数来创建实例,并传入相应的配置参数。 对于左右联动的swiper实例,我们可以添加"navigation"选项,用来显示左右箭头按钮。同,我们还可以使用"controller"选项,将其与上下滚动的swiper实例进行控制关联。 对于上下滚动的swiper实例,我们可以添加"direction"选项,将其设置为"vertical",并可以使用"keyboard"选项来启用键盘控制。 通过上述的配置和设置,我们可以实现左右联动和上下滚动的效果。用户在左右滑动,上下滚动的内容也会同步变化,从而实现了左右联动上下滚动的效果。 总之,通过swiperjs插件的灵活配置和丰富功能,我们可以很容易地实现左右联动和上下滚动的效果,为移动端的网页和应用增加交互和视觉上的吸引力。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值