I have produced a bunch of DHTML library functions that work in a cross-platform environment, down to the point of redefining the layer object in Netscape and writing customized event handlers. Now that I can do virtually anything I want with layers, the sheer amount of code this requires is making my pages amazingly heavy (for example, something that should be about 30 KB has now blown up to about 80 KB). How can I optimize my code so that I can get my page sizes down to a reasonable amount?
Unless I need animation, I don’t include the animation JS file in a Web page. I can use the single-action objects for any DHTML I need, and the page doesn’t have the extra download size of including both groups of functions:
However, when I do need the animation, I include both JS files within the Web page: