I have a script that I would like to run everytime the page is resized, so I am thinking to use the
onresize event. But I also have some code that I will need to run when the DOM is ready, so I will wrap it inside a
I believe the script that is run onresize doesn't need to be inside a document ready, so is it worth splitting the 2 scripts into 2 separate files?
From here, in general, is it fair to say that the portion of a script that doesn't need to be inside a document ready should be in its own file and the same for the portion that needs to be inside a document ready (even if the one script could potentially call a function in the other file)?
All 4 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.