开发者

Is it possible to load two instances of a jquery plugin, jQuery Facebook Multi Friend Selector on the same page?

I am using the jfmfs(jquery facebook multi friend selector) jquery plugin in a project and would like to know, if its possible to have two plugin instances of this running in the same page?

For example, this is how I created one instance and its working perfectly fine.

$("#jfmfs-container").jfmfs({ 
                          max_selected: 3, 
                      max_selected_message: "{0} of {1} selected",
                      friend_fields: "id,name,last_name",
                      sorter: function(a, b) {
                                    var x = a.last_name.toLowerCase();
                                    var y = b.last_name.toLowerCase();
                                    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
                      },
                   开发者_StackOverflow社区                           labels: {
                                                selected: "Selected",
                                                filter_default: "Start typing a name",
                                                filter_title: "Find WinkMates:",
                                                all: "All",
                                                max_selected_message: "{0} of {1} selected"
                                                // message to display showing how many items are already selected like: "{0} of {1} chosen"
                                              }

                  });

If I try to use the same container in an another div or create a whole new container to load the second instance, it doesn't seem to work.

Any idea guys?


You can try with a class and not an id, i use class instead of id in other jquery stuff and in this way i can load multiple instances. something like this:

$("#jfmfs-container").jfmfs({ 

                          max_selected: 3, 

to

$(".jfmfs-container").jfmfs({ 
                          max_selected: 3, 

in this way every container will use a diferent instance

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜