Javascript sliding image gallery, ... how?
I was wondering of any of you could push me in the right direction :). I'm trying 2 make an image "sliding" gallery, but it is a little complicated. it has 2 have 3 or 5 "views" the mainview ( the one you are currently watching) a previous and a next. The previous and the next must dynamically load images and unload them when they are 2 positions out of view.开发者_JS百科
So what it comes down to, i have 150 images i want to display in a sliding gallery and i only want to load 5 at a time if i scroll 2 the right image one should be unloaded and image 3,4,5 and 6 should be loaded and image 2 should be displayed. I have no real experience with Javascript.
(It should look alot like iphone Photo App :))
Kind Regards, Bart
First of all, you need to take a look at jQuery javascript library, because it'll help you in document manipulation.
Having this, you can use AJAX.
I'd suggest you to do that:
1) The images are dinamically loaded, meaning that when an user ask for the next N pics (let's say, 5), some AJAX script will request for the next N pics, preloading them with the Javascript's Image object.
2) Using jQuery, you can create slideshow-style transition animations.
3) Finally, depending on your target users, you can take advantage of HTML5, but you know that its support is limited to a very small percentage of global internet audience.
精彩评论