Jquery hover放大了多个具有相同名称前缀的图像,如-image1,image2,

时间:2018-02-19 16:36:48

标签: jquery html css ajax

我有一个jquery每个循环绑定图像的ID为:$(" [id ^ = MokeImage]")。  实际上我想悬停,放大图像。我认为在我找不到的ID中有一些问题请帮助我。



$(document).ready(function () {
        $("[id^=MokeImage]").hover(function () {
            $(this).addClass('transition');

            }, function () {
                $(this).removeClass('transition');
            });
        });
        
        

.transition {
  -webkit-transform: scale(1.6);
  -moz-transform: scale(1.6);
  -o-transform: scale(1.6);
  transform: scale(1.6);
}

img[id^=MokeImage] {
  -webkit-transition: all .4s ease-in-out;
  -moz-transition: all .4s ease-in-out;
  -o-transition: all .4s ease-in-out;
  -ms-transition: all .4s ease-in-out;
}

img[id^=MokeImage] {
  width: 50px;
  margin: 50px;
}




这是使用ajax绑定图像:



 $(document).ready(function () {
     
            $.ajax({
    
                type: "get",
                url: "@Url.Content("~/Sales/GetGangingTransportOrders")",
                data: ({ CustomerId: selectedcutomer }),
    
                datatype: "json",
                traditional: true,
                success: function (data) {
    
                    var json = data.GangingBatchModel;
                    
                    **$.each(json, function (index, obj) {
                        var row =
                               '<tr><td style="width:20mm"><img src="' + 
          obj.ImageUrl + '" id = "MokeImage' + index + '" style="width:100%"/></td></tr>'**  
                              
                    });
    });
&#13;
&#13;
&#13;

0 个答案:

没有答案