2012-12-12 72 views
2

如何更改默認選項jquery.mentionsInput(jQuery插件)如何更改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>') 
    } 
    }; 
.... 

如何從

$('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' } 
     ]; 
    } 
    }); 

回答

1

設置其他triggerChar值從docs設置triggerChar例如

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

    onDataRequest: function(){}, 
    triggerChar: '#' 
}); 
相關問題