jquery - 如何使用 scroll fixed witin parent..我想要滚动但是 nexbutton 和 prevbuton 是固定移动的..如何使用 jquery

标签 jquery css

我在 itemsClass 中 wanted prevbutton 和 nextbutton 当滚动总是居中时是固定的...................... ............

<div class="container">
   <div class="items">
    <div class="prevbutton button"> prev </div>
    <div class="nextbutton button"> next  </div>
  </div>
 </div>

//CSS

.container{
  border:1px solid green;
  text-align:center;
  vertical-align:middle;
  padding:5px 0px;
 }
.items{
   border:1px solid red;
   height:800px;
   position:relative;
   width:500px;
   margin:0 auto;
 }
 .prevbutton,.nextbutton{
top:50%;
cursor:pointer;
position:absolute;
background-color:#FF8000;
font-size:25pt;
   border:1px solid red;
    width:80px;
   text-align:center;
 }
 .prevbutton{left:-88px;}

 .nextbutton{right:-88px;}

//jquery

 $(window).bind('scroll', function () {
  if ($(window).scrollTop() > num) {
      $('.button').addClass('fixed');
      } else {
      $('.button').removeClass('fixed');
  }
  });

我希望在 itemClass 中滚动时居中 prediv 和 nextdiv enter image description here

滚动时..我们如何jquery

enter image description here

enter image description here

我想要这种风格,它总是居中的上一个和下一个按钮.... 如何使用 jquery 和 css

参见 jsfiddle http://jsfiddle.net/kisspa/5kE2y/ 参见示例 http://www.waypointarts.com/blog/2013/06/29/fixing-a-side-bar-while-scrolling-until-bottom

最佳答案

add this css it works jquery not needed
.prevbutton,.nextbutton{
top:50%;
cursor:pointer;
position:fixed;
background-color:#FF8000;
font-size:25pt;
border:1px solid red;
width:80px;
text-align:center;
 }
.prevbutton{left:0px;}

.nextbutton{right:0px;}

关于jquery - 如何使用 scroll fixed witin parent..我想要滚动但是 nexbutton 和 prevbuton 是固定移动的..如何使用 jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24443184/

相关文章:

html - 如何在 dojo 中设置 float Pane 的位置?

javascript - JQueryUI 垂直选项卡 - 添加一些(显然不相关的)CSS 样式后,用于选项卡功能的 JS 停止工作

javascript - 收到错误 : JavaScript runtime error: Circular reference in value argument not supported

javascript - 弹出格式化的模式对话框并在用户确认时转发

php - 编辑和删除按钮在php,ajax中添加到服务器端数据表

html - 创建以相同宽度向左浮动的 div 框的问题

css - 获取两种颜色之间所有颜色的十六进制代码?

javascript - 单击按钮后,在单击事件进行时在按钮上显示微调器图标

javascript - JQuery语法困惑

jquery - ASP.NET MVC SimpleMembership 登录因捆绑和缩小而失败