Bear Bibeault wrote:
Now I don't know why but sometimes my server hangs but then again I am guessing all servers hang since sometimes when I go to sites it take forever to load but if you do a refresh it loads up instantly and that's the same case with my site.
No, this is not normal. You need to find out why this is happening.
Bear Bibeault wrote:http://docs.jquery.com/Plugins/livequery
Bear Bibeault wrote:Check out the LiveQuery plugin.
Bear Bibeault wrote:I've used both, but I tend to use the "live" approach unless I have a good reason not to.
Bear Bibeault wrote:
Michael Hubele wrote:I don't know I just thought for some reason that all contents from that tab is destroyed on a click of a new tab.
The HTML for a tab is replaced when you click the tab a second time. But that won't "replace" any script -- script isn't part of the DOM. Once script is loaded into the page, it's there for the life of the page.
By the way, using Firebug for Firefox let's you observe exactly what's going on with the DOM.
So I your saying to take all my plug in scripts and custom scripts from all my tabs(4 tabs in total) and put them all in my main html page and then change all my events to "live"?
yeah, pretty much. I also make use of the LiveQuery plugin's match handlers.
I read some forum post saying using too many of them can slow down your site but I never looked into it and I am not sure what this person meant by many
Me either. It does require some heavy-duty processing -- but I've never noticed any performance degradation as a result.
Also how does that work for things that require binding of plugins. Like I use for instance a color picker on my site. How do I make that use "live"?
You can't. But that's where a match handler comes in handy.
As for the second way I don't know how I could make something that looks to see if it is loaded up or not.
Bear Bibeault wrote:I think you might be confusing the way that the Ajax tabs work with the way that iframes work.
When jQuery makes the Ajax request for a tab's contents, that content is not loaded into a separate window the way that it would be with an iframe. Rather, whatever is fetched from the server as the response is simply loaded into the current DOM and becomes part of the same page.
So yes, if the response contains script, it will be executed on the same page multiple times.
I do hope that your tab responses aren't full HTML pages, are they? They should be HTML fragments suitable for placement within the page.
You can do one of two things:
Pre-load all scripts that the tab contents will need in the "main" page so that they're there when the tabs get loaded. This is what I tend to do, and the .live() method is essential for this. Put logic in the scripts to detect whether they've already been loaded, and skip re-defining anything if so.
Bear Bibeault wrote:Probably not what you wanted to hear, but it's probably time to break open the plugin code and see what it's doing...
Bear Bibeault wrote:Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.
You can go back and change your post to add code tags by clicking the button on your post.
Bear Bibeault wrote:I haven't used the remote rule yet myself. Are you sure it's kicking off the check?
Eric Pascarello wrote:Most people merge files together with their Maven/Ant builds.
What is a CName? Basically a sub domain.
Eric Pascarello wrote:There are many factors that cause load times to be slow.
You should probably combine the files into fewer files. Means less http requests. You should also at a minimum remove the comments and whitespace from the JS/CSS files. Look into optimizing any images. Make sure you are not using spacer images or any useless image file.
Look at the YSlow plugin for Firebug.