Finding Image and Place into another img source
Posted
by saorabh
on Stack Overflow
See other posts from Stack Overflow
or by saorabh
Published on 2010-06-09T10:33:03Z
Indexed on
2010/06/09
10:42 UTC
Read the original article
Hit count: 203
My Html Markup is like this
<div id="main">
<div id="slider">
<img src=""/>
</div>
<div class="clear slider"></div>
<div class="slider ndslider">
<a href="#" rel="bookmark">
<img src="#" title=""/>
</a>
</div>
<div class="slider rdslider">
<a href="" rel="bookmark">
<img src="" title=""/>
</a>
</div>
<div class="slider thslider nivoSlider">
<a rel="bookmark" href="" class="nivo-imageLink" >
<img src="image src" >
</a>
<a rel="bookmark" href="" class="nivo-imageLink">
<img title="" src="">
</a>
<a rel="bookmark" href="#" class="nivo-imageLink">
<img title="" src="">
</a>
<div class="nivo-slice"></div>
<div class="nivo-slice"></div>
<div class="nivo-slice"></div>
<div class="nivo-directionNav">
<a class="nivo-prevNav">Prev</a>
<a class="nivo-nextNav">Next</a>
</div>
<div class="nivo-controlNav">
<a rel="0" class="nivo-control active">
<img alt="" src="undefined">
</a>
<a rel="1" class="nivo-control">
<img alt="" src="undefined">
</a>
</div>
</div>
</div>
I want to find the all the images inside this DIV
<div class="slider thslider nivoSlider">
</div>
and set that images on to this
<div class="nivo-controlNav">
<a rel="0" class="nivo-control active">
<img alt="" src="undefined">
</a>
</div>
For Doing the same i had written my custom jQuery but it is not working.
jQuery(document).ready(function() {
jQuery('.thslider a img').each(function(){
var imgSrc = jQuery(this).attr('src');
var newSrc = 'http://saorabh-test1.rtcamp.info/wp-content/themes/twentyten/timthumb.php?src='+ imgSrc +' &h=50&w=50&zc=1';
jQuery(".thslider .nivo-controlNav a img").attr('src',newSrc);
});
});
Help me..
© Stack Overflow or respective owner