I’m making a portfolio site in which each project expands on click and inside there’s a image gallery.
The problem I’m facing is that the site gets pretty slow once many images are loaded. Is there a way to load the content on click and once I click some other project, the previous gallery content to be completely unloaded ?
I’m not very experienced with jQuery so an example of this would help a lot.
Once you click, create a new div, load everything you want to show inside that div and show it to the user. Have a button there to close it. Once you do, destroy the div.
To create the div read: Creating a div element in jQuery
To destroy it just $(‘#div_id’).remove();