drayarms Posted October 17, 2011 Share Posted October 17, 2011 Hello people, my problem may sound a little unnecessary, but you guys must bare with me, I'm trying to create this really cool site with lots of special effects and I'm literally pushing the envelope. I'll simply describe the problem, showing the code isn't all that necessary. The site in question has a menu bar, which loads the various pages associated with each menu item by making an AJAX call, when the menu item is clicked and not by making the usual trip to the server and waiting for the new page to load. So basically, only the unique content of each page is loaded, while the header and footer remains static. As soon as I accomplished that, I immediately realized that I had created a new problem. Like I said, the site is supposed to be filled with lots of j Query special effects. I'm currently working on some sliding effect on the homepage which is called with a document ready function. So when the homepage loads, the effect nicely runs on my screen. Well if I load another page, by clicking on its corresponding menu item, then decide to go back to the home page (by clicking home), the static markup on the homepage loads quite alright, but the dynamic elements, controlled by the j Query document ready function don't. Of course I understand why this is the case, but how can I remedy this? I have tried to replace the document ready function with a named function called load, then call that function with an onload event in the div that contains the content for the homepage, like this: <script type = "text/javascript"> function load() { $("#slide1").animate({width: "toggle"}, '5000').delay(4000).animate({width: "toggle"},'5000'); } <div onload = "load"> content unique to the homepage ...</div> That didn't work. I also tried this: <div onload =" $(\"#slide1\").animate({width: \"toggle\"}, '5000').delay(4000).animate({width: \"toggle\"},'5000');"> content unique to the homepage...</div> Also to no avail. Any suggestions greatly welcome. Quote Link to comment https://forums.phpfreaks.com/topic/249253-need-script-to-run-upon-reloading-page-via-ajax/ Share on other sites More sharing options...
trq Posted October 17, 2011 Share Posted October 17, 2011 We need to see code. Quote Link to comment https://forums.phpfreaks.com/topic/249253-need-script-to-run-upon-reloading-page-via-ajax/#findComment-1279905 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.