开发者

jScrollPane Problem AJAX and After()

开发者 https://www.devze.com 2023-02-28 22:22 出处:网络
I have an annoying problem that im im hoping wont be hard to fix.My scroll pane area wont resize when new child elements are added

I have an annoying problem that im im hoping wont be hard to fix. My scroll pane area wont resize when new child elements are added

Basically, I have a div container, with id #responseLog, inside this container are multiple divs with classes .response. So, like this

<div id="responseLog">
  <div class="response"></div>
  <div class="response"></div>
</div>

The responses contain various spans etc. The jScrollPane is being called on the responseLog div. It works fine on page load.

I have an AJAX function that is called often and inserts new response divs inside the main responseLog div. This works fine. The AJAX call does not replace any content, it simply injects new elements using the jQuery After() method and selecting the last div.

Once the new elements are adde开发者_高级运维d, I call the reinitialize function on the jScrollPane. ie

jspapi.reinitialise();

My problem is that this reinitialize does nothing. It doesn't resize the responseLog div even though more elements have been added.

I know the jScrollpane site mentions an AJAX section, but thats referring to replacing the contents of the div, not just appending to it.

Can anyone help please?


I found the solution. It was to use the jspapi.getContentPane().append() method instead of the jQuery native append method.

0

精彩评论

暂无评论...
验证码 换一张
取 消