/    Sign up×
Community /Pin to ProfileBookmark

How do I make 1 big pic and 2 small like on ebay?

I would like to know how to make it so on a page, I have a larger picture and 3 smaller ones next to it. You click on the small picture, it shows up where the bigger one is. Like they do on ebay, and I’ve seen some stores that have this.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JPnycSep 03.2004 — You can actually do it with frames and straight HTML. Not the method I would choose, but most definitely the simplest. So if you know HTML you can do it right now. What web technologies are you familiar with?
Copy linkTweet thisAlerts:
@steelersfan88Sep 03.2004 — You mean something like the following? Not exactly sure if this is what you are looking for[code=php]<!-- DOCTYPE -->
<html>
<head>
<title>Example</title>
<script type="text/javascript">

function swap(b) {
var a = "pix0";
var tmp = document.getElementById(a).src;
document.getElementById(a).src=document.getElementById(b).src;
document.getElementById(b).src=tmp;
}

</script>
</head>
<body>
<div id="mn" style="width:400px;height:300px;">
<div style="float:left;width:75%">
<img src="pix0.png" id="pix0" width=300 height=300 alt="...">
</div>
<div style="float:left;width:25%">
<img src="pix1.png" id="pix1" width=100 height=100 onclick="swap(id)" alt="..."><BR>
<img src="pix2.png" id="pix2" width=100 height=100 onclick="swap(id)" alt="..."><BR>
<img src="pix3.png" id="pix3" width=100 height=100 onclick="swap(id)" alt="...">
</div>
</div>
</body>
</html>[/code]
Dr. Script
Copy linkTweet thisAlerts:
@steelersfan88Sep 03.2004 — or very similarly:[code=php]<!-- DOCTYPE -->
<html>
<head>
<title>Example</title>
<script type="text/javascript">

function swap(b,c) {
var a = document.getElementById("pix0");
var tmp = a.src;
a.src=c;
b.src=tmp;
}

</script>
</head>
<body>
<div id="mn" style="width:400px;height:300px;">
<div style="float:left;width:75%">
<img src="pix0.png" id="pix0" width=300 height=300>
</div>
<div style="float:left;width:25%">
<img src="pix1.png" id="pix1" width=100 height=100 onclick="swap(this,src)"><BR>
<img src="pix2.png" id="pix2" width=100 height=100 onclick="swap(this,src)"><BR>
<img src="pix3.png" id="pix3" width=100 height=100 onclick="swap(this,src)">
</div>
</div>
</body>
</html>[/code]
×

Success!

Help @vulfgrl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...