css/jquery: scroll limit with nested scoll and hidden scroll bar

瘦欲@ 提交于 2019-12-08 14:25:57

问题


Here is an example of what I want to do:

http://jsfiddle.net/bnsadku9/1/

I have a fixed header that is coverred by a div below when scrolled. At a fixed height the scroll stops and the div continues to scroll inside itself (to reveal the content).

There are are some minor problems with my current implementation:

1) I don't want to inner scroll bar to show up. I tried playing aroung with position and margin instead of overflow:scroll or with switching the z-position but that didn't work or hid the drop shadow. I also tried the trick with a wrapper div that is supposed to hide the scrollbar, but that doesn't seem to work for some reason:

http://jsfiddle.net/bnsadku9/2/

        var vcontentWidth = document.getElementById("content").scrollWidth;
        document.getElementById("wrapper").style.width = vcontentWidth + "px";

This is supposed to change the size of the wrapper to hide the scrollbar. I tried different position values too but neither works.

2) When the bottom of of the inner div is reached the scroll jumps to the top.

3) The focus of what to scroll is not always working (in Firefox at least).

The question is: How to fix those problems OR how to implement the required functionality in a different way.

来源:https://stackoverflow.com/questions/25746195/css-jquery-scroll-limit-with-nested-scoll-and-hidden-scroll-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!