如何在jquery移动可折叠列表中添加多个图标 [英] How to add multiple icons in jquery mobile collapsible list

查看:150
本文介绍了如何在jquery移动可折叠列表中添加多个图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在jquery移动可折叠列表的加号图标附近添加另一个图标。但由于jquery mobile动态创建该图标,因此无法添加它。任何建议将不胜感激!

I would like to add an another icon near by the plus icon of the jquery mobile collapsible list. But could not able to add it since jquery mobile creates that icon dynamically. Any suggestion would be greatly appreciated!

推荐答案

这肯定是一个黑客,但你可以等待页面初始化,然后找到列表视图小部件并将jQuery Mobile HTML附加到每个列表项的图标:

This is certainly a hack but you can wait for the page to initialize, then find the list-view widget and append the jQuery Mobile HTML for an icon to each list-item:

//wait for a certain pseudo-page to initialize
$(document).delegate('#home', 'pageinit', function () {

    //find the listview and append to it's second tier children (the `<div class="ui-btn-inner ui-li" />` element)
    $(this).find('ul[data-role="listview"]').children().children().append('<span class="ui-icon ui-icon-home ui-icon-shadow" style="right:30px;">&nbsp;</span>');
});​

注意我改变了新图标的CSS属性,因此它与初始图标不重叠。

Notice I changed the right CSS property of the new icon so it doesn't overlap the initial icon.

这是一个演示: http://jsfiddle.net/uZxXB/

这篇关于如何在jquery移动可折叠列表中添加多个图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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