FlashDancer
01-20-2012, 02:40 AM
I have an image gallery with about 10 images. Its a very simple image gallery, basically you have "A" "B" "C" "D" etc, and for each letter you click on, JavaScript changes the relative image from hidden to block.
The problem I have is that all of the 10 images load in the background, despite the user not clicking on the corresponding letter, which wastes a ton of bandwidth.
I have isolated and placed the image gallery code into a HTML file and included 3 pics so you can see it working:
http://www.maxsurl.com/link.php?ref=rk925Lzd48
I don't know much about JavaScript, but I hope this code I just made up gives you can idea of what I am trying to achieve:
<SCRIPT type="text/javascript">
function pic1() {
load.pic('src="pic1.png"')
}
function pic2() {
load.pic('src="pic2.png"')
}
function pic3() {
load.pic('src="pic3.png"')
}
</SCRIPT>
<SPAN onclick="return pic1()">PIC 1</SPAN>
<SPAN onclick="return pic2()">PIC 2</SPAN>
<SPAN onclick="return pic2()">PIC 3</SPAN>
<IMG id="pic">
Does anyone have a suggestion on how I could achieve what I would like to do? If so, could you please show me a basic example of code so I can make sense of it (I am a visual learner).
The problem I have is that all of the 10 images load in the background, despite the user not clicking on the corresponding letter, which wastes a ton of bandwidth.
I have isolated and placed the image gallery code into a HTML file and included 3 pics so you can see it working:
http://www.maxsurl.com/link.php?ref=rk925Lzd48
I don't know much about JavaScript, but I hope this code I just made up gives you can idea of what I am trying to achieve:
<SCRIPT type="text/javascript">
function pic1() {
load.pic('src="pic1.png"')
}
function pic2() {
load.pic('src="pic2.png"')
}
function pic3() {
load.pic('src="pic3.png"')
}
</SCRIPT>
<SPAN onclick="return pic1()">PIC 1</SPAN>
<SPAN onclick="return pic2()">PIC 2</SPAN>
<SPAN onclick="return pic2()">PIC 3</SPAN>
<IMG id="pic">
Does anyone have a suggestion on how I could achieve what I would like to do? If so, could you please show me a basic example of code so I can make sense of it (I am a visual learner).