jQuery追加-图片内联 [英] Jquery append - Image inline

查看:94
本文介绍了jQuery追加-图片内联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将图像添加到div中.当图像追加时.正在显示阻止".我需要它们显示内联.

I'm trying to add images to a div. When the images append. The are displaying "block". I need them to display inline.

这是我正在运行的代码:

This is the code I am running:

$(".showvideothumbs").append($('<img src="/garageimages/'+data.thumb+'" style="display:inline">').hide().fadeIn(2000));

我尝试将其包装在已设置"display:inline"的div中,但jquery将其更改为"display:block".

I've tried wrapping it in a div that has "display:inline" set, but jquery changes that to "display:block".

推荐答案

使用回调.

$(".showvideothumbs").append('&lt;img src="/garageimages/'+data.thumb+'" style="display:none;"/&gt;').find('img').fadeIn(2000,function(){
    $(this).css('display', 'inline');
});

这篇关于jQuery追加-图片内联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆