【问题标题】:can we change size(width) of facebook like token input?我们可以像令牌输入一样更改 Facebook 的大小(宽度)吗?
【发布时间】:2014-08-11 02:41:01
【问题描述】:

我正在使用 facebook 之类的令牌输入,我想根据我的文本框更改其宽度。

$("input#receiver_id").tokenInput("add", {id : jsonData.id, first_name: jsonData.firstname, last_name: jsonData.lastname}); 
//Token input---------------
    $("#receiver_id").tokenInput(PROJECT_URL+PROJECT_NAME+"mail/get-my-matching-contacts", {
        onAdd: function (item) {
            $("div#receiver_ids_holder").append("<input type = 'hidden' name = 'receiver_ids[]' class = 'receiver_ids' id = '"+item.id+"' value = '"+item.id+"'>");
            $("#jq_receiver_id").attr('placeholder','');
        },
        onDelete: function (item) {
            $('div#receiver_ids_holder input#'+item.id).remove();
        }, 
        theme: "facebook",
        propertyToSearch: "first_name",
        propertyToSearch: "last_name",
        resultsFormatter: function(item){ return "<li><div style = 'width:25px; height:25px; display:inline-block;margin:0 0 4px 0;'><div style = 'width:25px; height:25px; display : table-cell; vertical-align: middle; text-align: center;'>" + "<img style = 'max-width : 25px; max-height : 25px;' src='" + item.url + "' title='" + item.first_name + " " + item.last_name + "'/></div></div>" + "<div style='display: inline-block; padding-left: 10px;'><div class='full_name'>" + item.first_name + " " + item.last_name + "</div><div class='email'>" + item.email + "</div></div></li>" },
        tokenFormatter: function(item) { return "<li><p>" + item.first_name + " " + item.last_name + "</p></li>" },
    });

我试图在它的 css 中给出宽度,但没有奏效。 在这方面需要一些即时帮助。

【问题讨论】:

  • 你用 CSS 给宽度做了什么尝试。你能发布那段代码吗?
  • @chris div.token-input-dropdown-facebook ul li.token-input-selected-dropdown-item-facebook{ 宽度:100%; }

标签: jquery-tokeninput


【解决方案1】:

我在我的 html 文档中添加了这种样式并为我工作。如果您有兴趣,这里是 link 自定义下拉列表。

<style>
ul.token-input-list-facebook
{
   width:100%;
}
</style>

<script>
 $(document).ready(function(){
 $("ul").css({"width":"100%";});
});
</script>

【讨论】:

  • 只是样式标签对我有用,不需要脚本标签。
猜你喜欢
  • 1970-01-01
  • 2015-08-15
  • 2020-08-28
  • 2022-10-16
  • 1970-01-01
  • 2015-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多