Now, one thing I noticed by using this approach was that there was a lag while showing the content after the shadowbox window opened up. I had just built a carousel video player for our JVF homepage and wanted the videos to pop open quickly and start playing fast. So it was bugging me that I could hit the flash player webpage links directly and they would play within 2-3 seconds, however, each time I loaded that same URL into shadowbox it would take 8-10 seconds.
The file that you’ll need to find is shadowbox-iframe.js and is found in the players directory within the shadowbox library. The first thing you’ll notice is that the file has been reduced by removing all the white space, which makes it quick to load, but annoying to maintain. Do a quick search for the beginning of the “src attribute upfront:
Now, to ensure that we don’t double load the content, cause a flicker and introduce more lag, let’s make sure to remove the original call on onLoad event. To solve this, look for the following text “b.location.href=this.obj.content” and comment it out:
This fix was able to cut our load time in half! Give it a try and see if this helps speed up your own dynamic content. Enjoy!