div jspVerticalBar missing inside the jspContainer

2019-09-05 05:52发布

In my current web project Im trying to change the scrollbar with a lib called jScrollPane.

The script applies and generates the jspContainer, but the div jspVerticalBar ist missing. First I thought the script got problems when its loaded in with .load. But I placed the script tag in the view.html that is getting loaded in.

Another problem is when I go to another view and return to the front page, the script generates a wrong width of the container. Is is so small that the content of the container gets invisible by the overflow:hidden.

Does anyone got an idea why this happens? Did I do something wrong? Can you please help me out with this?

Here are all informations you may need:

@import url("sbar.css"); /*in main.css*/

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/vendor/mwheel.js"></script>
<script src="js/vendor/jscrollpane.js"></script>
<script src="js/main.js"></script>

<script>
$(document).ready(function() {
    $(".scroll-pane").jScrollPane(); // in startseite.html
});
</script>

The live example: Link

1条回答
Rolldiameter
2楼-- · 2019-09-05 06:29

I know I am too late to reply, but just thought that other people like me, who came here just to find the answer to the question, might get some help

Checkpoints:

  1. the container must have a fixed width (or at least a maximum width)
  2. the container must have a fixed height (in pixel, e.g., 200px, 250px)
  3. the container must have overflow:auto; (or at least overflow-x:hidden;overflow-y:auto;)
  4. a regular scrollbar must appear without applying jScrollPane

    Important

  5. In case you still cannot fix the issue, then here is one additional checkpoint:
    ? Are you adding contents dynamically to your container on which jScrollPane is applied?
    If the answer to above question is yes, then please consider the reinitialise() api of jScrollPane and use it after dynamically adding the content.
    The above mentioned api is very useful for a SPA
    For more information and example, please visit: http://jscrollpane.kelvinluck.com/dynamic_content.html

查看更多
登录 后发表回答