English 中文(简体)
Jquery对他人使用一种源像
原标题:Jquery apply one source image to another

I ve got a greater slider形象 and a small "thumbnail”index. 到目前为止,我有这一法典:

 $j(".slider-img").each( function(){
  var slideSource = $j(this).attr("src");
   $j(".slider-thumb").each(function() {
    $j(this).attr("src", slideSource); 
   });
 });

但是,它给我留下了所有th首幻灯片的图像。 因此,我想从每一方.slider-img中提取来源,并将其应用于每一方。 想法?

最佳回答

假设与<代码>.slider-img对应的.slider-thumb在该文件中的地位相同,相对于其他类别而言,你可以使用:

var thumbs = $j( .slider-thumb );
$j( .slider-img ).each(function(i) { // i is the position in the set
    thumbs.eq(i).attr( src , this.src); // set the src attribute of the element with position i in the thumbs set to the src of this element
});
问题回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签