View Full Version : Pure JS Image Gallery no libraries, no plugins

01-03-2011, 03:36 PM
Hello guys,

I was wondering if someone could help me out. I am trying to create an image gallery in javascript without the use of jquery, mootools or any other library. The tutorials out there and even the javascript books I own all use jquery or other library.

I currently have some thumbnails and when clicked, they should display a bigger image in a selected space.

The image gallery is to be looped and to start automatically while being controlled by buttons or thumbnails. What is the best way to go about this, please bear in mind that I am quite new javascript itself.


rnd me
01-03-2011, 06:18 PM
after having have created my own, i would use jQuery if i had to do it again.

look at the spaghetti of dom and event code i used in the source of http://danml.com/pub/photos.htm . granted, much of it is for zooming, which you didn't mention, but consistently sizing things in the dom is a real PITA.

the code is a couple years old at this point, and i would write it better now, but it should give you an idea. Feel free to rip off chunks if it helps.

My advice would be to first write out every feature you need in english. Under each feature, write out english programming outlines on how you plan to accomplish the feature. Once you have a complete plan, pick a feature, most important first, anmd start coding. Cross off each section when you successfully add the feature and it doesn't break old functionality. Without libraries, there's gonna be a whole lot of little chunks. Planning is a big, if boring, part of writing a great app.

01-04-2011, 11:31 AM
Thanks for your help, I will give it a go and let you know how it works out. Left to me as well I would use jquery or some other library but as it is not allowed in this case, I'll go with your suggestions. Again thanks.:thumbsup: