jquery移动动态列表视图单元格高度
早上好,
所以我有一个简单的问题,我似乎在任何地方都找不到。有谁知道如何根据内容的高度动态调整列表视图单元格的高度?我正在创建这样的单元格:
$threadTable.append(
$('<li>').append(
$('<img>').attr('src',"photo/url").attr('onerror','imageError(this);'),
$('<h3>').text(message.username),
$('<p>').html(message.body ? message.body : "There is no message text for this message")
));
我希望向
添加 CSS 自动换行属性可以达到目的,但可惜的是,内容仍然溢出到单元格之外。有谁知道如何解决这个问题以增加细胞的高度?谢谢!
只是尝试这样做: $('
').html(message.body ? message.body : "此消息没有消息文本").css({"overflow":"visible"})
没有骰子...
Good morning SO,
So I have a simple question I can't seem to find anywhere. Does anyone know how to dynamically adjust the height of a listview cell depending on the height of the content? I am creating the cells like this:
$threadTable.append(
$('<li>').append(
$('<img>').attr('src',"photo/url").attr('onerror','imageError(this);'),
$('<h3>').text(message.username),
$('<p>').html(message.body ? message.body : "There is no message text for this message")
));
I was hoping adding a CSS word wrap attribute to the <p>
would do the trick, but alas, the content is still overflowing outside the cell. Does anyone know what would solve this to grow the height of the cell? Thanks!
Just tried to do this:$('<p>').html(message.body ? message.body : "There is no message text for this message").css({"overflow":"visible"})
No dice...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我找到了一个可行的 CSS 解决方案:
基本上您只需覆盖默认的 JQM 溢出选项即可。这就成功了。希望能帮助其他人解决这个问题......:)
So I found a CSS solution that works:
basically you just have to override the default JQM overflow options. That did the trick. Hope that helps someone else with this problem... :)