-2

I'm using mCustomScrollbar to styling the scroll bar but got some issue. The effect will not appear when I change the page dynamically.

<link rel="stylesheet" href="css/jquery.mCustomScrollbar.css" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/jquery.mCustomScrollbar.concat.min.js"></script>

And I using this function to change the page.

function processResponse() {  
    if (request.readyState == 4) {   
        if (request.status == 200) {   
        var response = request.responseText;
document.getElementById("content").innerHTML = response;
      }
   }
}

I didn't change any code in js file. Also, it's work if I directly enter to the page. Is any function I need to add in processResponse function?

In the dynamic page: I added the class called "content mCustomScrollbar" that is required by the mCustomScrollbar

<div id="content" style="position: absolute;left: 7%;right: 7%">
<div id="id_div_paragraph" class="content mCustomScrollbar" style="position: absolute;left: 450px;float:left;/*padding:20px 28px;*/padding-top: 20px;padding-left: 28px;padding-bottom: 20px;padding-right: 15px;font-size:18px;overflow: auto;background-color:#FFFFFF;opacity:0.75;">
Content Here....
</div>

Thank you.

  • What's the response body? You also need to reset the scrollbar each time content changes. What errors are you getting? – W.B. Jul 16 '14 at 06:31
  • I getting no error in that code in computer side. I'm using the library called 'mCustomScrollbar' to change the style of the ScrollBar in Div but it's not functional when changed the page(change div "content") – user3769892 Jul 16 '14 at 07:35
  • I know, what you're using. What I don't know is everything else. How are you applying the scrollbar? What element are you applying it to? What is the body of you response (again)? Where are you setting the scrollbar again after you have loaded your dynamic content? I mean, **throw me a frickin' bone** – W.B. Jul 16 '14 at 07:39
  • I'm sorry. I added the new code that is the code in dynamic page. It's is no any javascript in that page. Thank you – user3769892 Jul 16 '14 at 07:47
  • First, you have to call mCustomScrollbar after the page loads to update its positron, etc. Second, are you sure you're not adding another "content" around each time you load the dynamic content? And third, is it possible to share a working example of your problems? – W.B. Jul 16 '14 at 14:04

1 Answers1

0

Please replace your Jquery library file in first position like this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/jquery.mCustomScrollbar.concat.min.js"></script>
Sudharsan S
  • 15,336
  • 3
  • 31
  • 49