File tree 3 files changed +49
-11
lines changed
3 files changed +49
-11
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ The color of the smiley image that appears on the picker button. Acceptable valu
82
82
The background color of the picker button. Any hex value is acceptable. Defaults to '#eee' if no iconBackgroundColor is specified.
83
83
84
84
### recentCount (int) ###
85
- The number of emojis that should show in the 'Recently Used' section. Defaults to 36 if no recentCount is specified.
85
+ The number of emojis that should show in the 'Recently Used' section. Defaults to 36 if no recentCount is specified.
86
86
87
87
Note: 'Recently Used' will only show for the user if their browser supports HTML5 Local Storage.
88
88
@@ -121,6 +121,18 @@ $('#question').emojiPicker('toggle');
121
121
122
122
You can see an example of this in the [ demo] ( http://wedgies.github.io/jquery-emoji-picker/demo.html ) .
123
123
124
+ ## Destroying the Emoji Picker ##
125
+
126
+ To remove the the emoji picker html and event listeners, simply call the emoji picker function with the ` destroy ` option:
127
+
128
+ ``` javascript
129
+ $ (' #question' ).emojiPicker (' destroy' );
130
+ ```
131
+
132
+ An example of this can be found in the [ demo] ( http://wedgies.github.io/jquery-emoji-picker/demo.html ) .
133
+
134
+
135
+
124
136
## Notes ##
125
137
126
138
jQuery Emoji Picker is disabled for mobile devices, which already support the emoji keyboard.
Original file line number Diff line number Diff line change 13
13
< script type ="text/javascript ">
14
14
$ ( document ) . ready ( function ( e ) {
15
15
16
- $ ( '#text-custom-trigger' ) . emojiPicker ( {
17
- width : '300px' ,
18
- height : '200px' ,
19
- button : false
20
- } ) ;
21
-
22
16
$ ( '#input-default' ) . emojiPicker ( ) ;
23
17
24
18
$ ( '#input-custom-size' ) . emojiPicker ( {
30
24
position : 'left'
31
25
} ) ;
32
26
33
- $ ( '#trigger' ) . click ( function ( e ) {
27
+ $ ( '#create' ) . click ( function ( e ) {
28
+ e . preventDefault ( ) ;
29
+ $ ( '#text-custom-trigger' ) . emojiPicker ( {
30
+ width : '300px' ,
31
+ height : '200px' ,
32
+ button : false
33
+ } ) ;
34
+ } ) ;
35
+
36
+ $ ( '#toggle' ) . click ( function ( e ) {
34
37
e . preventDefault ( ) ;
35
38
$ ( '#text-custom-trigger' ) . emojiPicker ( 'toggle' ) ;
36
39
} ) ;
37
40
38
- // keyup event is fired
41
+ $ ( '#destroy' ) . click ( function ( e ) {
42
+ e . preventDefault ( ) ;
43
+ $ ( '#text-custom-trigger' ) . emojiPicker ( 'destroy' ) ;
44
+ } )
45
+
46
+ // keyup event is fired
39
47
$ ( ".emojiable-question, .emojiable-option" ) . on ( "keyup" , function ( ) {
40
48
//console.log("emoji added, input val() is: " + $(this).val());
41
49
} ) ;
58
66
<!-- 🌵 -->
59
67
< form >
60
68
61
- < button id ="trigger "> Custom emoji trigger</ button >
69
+ < button id ="create "> create</ button >
70
+
71
+ < button id ="toggle "> toggle</ button >
72
+
73
+ < button id ="destroy "> destroy</ button >
62
74
63
75
< div class ="field ">
64
76
< textarea id ="text-custom-trigger " class ="emojiable-question " placeholder ="Your Question "> </ textarea >
Original file line number Diff line number Diff line change 127
127
128
128
} ,
129
129
130
+ destroyPicker : function ( ) {
131
+ this . $picker . unbind ( 'mouseover' ) ;
132
+ this . $picker . unbind ( 'mouseout' ) ;
133
+ this . $picker . unbind ( 'click' ) ;
134
+ this . $picker . remove ( ) ;
135
+
136
+ $ . removeData ( this . $el . get ( 0 ) , 'emojiPicker' ) ;
137
+
138
+ return this ;
139
+ } ,
140
+
130
141
listen : function ( ) {
131
142
// If the button is being used, wrapper has not been set,
132
143
// and will not need a listener
392
403
switch ( options ) {
393
404
case 'toggle' :
394
405
plugin . iconClicked ( ) ;
395
- break ;
406
+ break ;
407
+ case 'destroy' :
408
+ plugin . destroyPicker ( ) ;
409
+ break ;
396
410
}
397
411
} ) ;
398
412
return this ;
You can’t perform that action at this time.
0 commit comments