Edg*_*dan 2 javascript jquery jquery-ui jquery-selectors
您好我已经看过类似的帖子,但没有人回答我想要完成的事情我在这里做了一个示例 http://jsfiddle.net/edgardo400/R6rVJ/
我基本上想要的是当父母点击发生你得到孩子的id并将其存储在一个变量中,所以我可以将变量currentID传递给下面的代码,否则我将不得不为每个id复制这个代码9次box1到box9
 jQuery(currentID).delegate("a", "hover", function(event){
        var $img = jQuery(this).parent("li").find('img');
        var image = jQuery(this).attr('data-img');
         jQuery('.defaultimg').stop(true, true).fadeOut();
        if( event.type === 'mouseenter' ) {
            if($img.length){
                $img.show();
            }else{
                jQuery(this).parent("li").append('<img id="theImg" src="' + image + '" />');
            }
        }else{
            if($img){
              $img.hide();  
            }
             jQuery('.defaultimg').stop(true, true).fadeIn();
        }
    });
});
$('#boxes').on('click', function(e) {
    var currentID = e.target.id;
    console.log(currentID);
......rest of code
| 归档时间: | 
 | 
| 查看次数: | 3777 次 | 
| 最近记录: |