2

如何更改 jquery.mentionsInput(jquery 插件)中的默认选项

(function ($, _, undefined) {

  // Settings
  var defaultSettings = {
    triggerChar   : '@',
    onDataRequest : $.noop,
    minChars      : 2,
    showAvatars   : true,
    elastic       : true,
    classes       : {
      autoCompleteItemActive : "active"
    },
    templates     : {
      wrapper                    : _.template('<div class="mentions-input-box"></div>'),
      autocompleteList           : _.template('<div class="mentions-autocomplete-list"></div>')
    }
  };
....

如何设置其他 triggerChar 值

  $('textarea.mention, input.mention').mentionsInput({

    onDataRequest:function (mode, query, callback) {
      var data = [
        { id:1, name:'Kenneth Auchenberg', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' }
      ];
    }
  });
4

1 回答 1

1

从您设置的文档triggerChar中,例如

$('textarea.mention, input.mention').mentionsInput({

  onDataRequest: function(){},
  triggerChar: '#'
});
于 2013-01-07T21:49:15.873 回答