1

I use .append() to load dynamic data in a page from another PHP page. The problem is the content from the another page have jquery scrollbars and tooltips. If I include jquery.js and remaining javascript code in that page the dynamically loaded content works well with the jquery scrollbars and tooltips but if I remove the jquery in that page it gets replaced with original windows scrollbar and tooltips. What is the solutions= for this?

Sample scrollbar code,

$('div.box').scrollbars();// scrolbars

PS: The reason I need to remove the script files from the second page is while using .load() or .append(), the host page freezes till the dynamic data loads completely.

4
  • do you call .scrollbars to the loaded content afterwards again? Commented Apr 29, 2013 at 7:16
  • @Alex: I tried that option using callback. But it makes the page freeze until the operation is complete. Commented Apr 29, 2013 at 7:17
  • 1
    Just initialize the scrollbars again when u load the content in your page. Dont call jquery and other js code instead put them in ur main page and then call scrollbars(); Commented Apr 29, 2013 at 7:19
  • 1
    well then I assume something with your markup/ html is wrong, since how long can it take to apply scrollbars() ? usually this no big deal and this should not take long at all. try to load the html without any js/ css and when finished loading, call .scrollbars() out of your original page Commented Apr 29, 2013 at 7:20

1 Answer 1

1

It will be really a bad practice too add script files again in the external file. Instead you have to add $('div.box').scrollbars();// scrolbars in the callback.

Example:

$("#samplediv").load('external_page.extension', function()  
{  
   $("#samplediv").scrollbars();  
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.