Click here to Skip to main content
15,895,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two images in div. one big one,another small.I want change both images on click of another image which is in another div. I am getting only one image change on click that is big one,small image is not changing.
please refer
http://www.houseofblouse.com/design/u-neck-2[^]
Posted
Comments
[no name] 6-Oct-15 3:28am    
How you are changing the image src through javascript or jQuery. Please provide part of your code.
Hussain Javed 6-Oct-15 3:57am    
this my function
function changeImage(){

document.getElementById('toChange').src='images/scrol v neck images/g.png';
document.getElementById('toChange1').src='images/scrol v neck images/g1.png';
document.getElementById('toChange2').src='images/scrol v neck images/g1.png';
document.getElementById('toChange3').src='images/scrol v neck images/g.png';
}
this is the image which i click
<div class="col-md-3" >
<img src="images/scrol v neck images/img1.png" style="width:120%;" />
<p style="text-align:center; padding-top:10px;"> Classic V </p>
</div>
this the div where image is changed
<div class="pad" >

<img src="images/scrol v neck images/g.png" class="vneck_imgbor img-responsive" id="toChange" style="padding-

left:60px;padding-right:50px;" />
<img class="front1" id="tochange2" src="images/scrol v neck images/g1.png" width="50" height="50">
</div>
</div>
<div class="back" style="width:300px;height:1600px;">
<div class="pad">
<img src="images/scrol v neck images/g1.png" class="vneck_imgbor img-responsive" id="toChange1" style="padding-

left:60px;padding-right:50px;" />
<img class="back1" id="tochange3" src="images/scrol v neck images/g.png" width="50" height="50">
</div>
</div>
big image is changing but small image is not changing.

Please refer to this demo here:
Change image on click with jQuery[^]

It shows in a very easy way how you can achecive it.
 
Share this answer
 
Comments
Hussain Javed 6-Oct-15 3:58am    
i want to chane another image on click of one image
please refer
http://www.houseofblouse.com/design/u-neck-2[^]
Palash Mondal_ 6-Oct-15 4:26am    
It is very difficult for me to figure out the issue here searching the whole app. I see images everywhere. Could you please post a functional example that illustrates your problem on Fiddle[^]. That would really help me to focus on the real issue, then debug and fix it.
JavaScript
$("#img1").click(function() {
    $("#bigImg").attr("src", "your-big-img-src");
    $("#smallImg").attr("src", "your-small-img-src");
});

You mean this ?
Make the necessary changes according to your need. ;)

-KR
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900