I just created my first XD Plugin for testing purposes and run into some problems. The question is if I’m missing something or are these bugs?
The plugin uses a modal dialog with a range slider to change the opacity of an element.
You can find the full source code of the main.js here:
Finally, the plugin works. But first I used some other code (which you see now as comments in the gist).
See line 49 - 54.
Line 52: Here I tried to set the innerHTML. The console returned “Plugin TypeError: this.html.charCodeAt is not a function”. I managed to get it to work with jQuery.
Line 54: If I use here id instead of class it will only work the first time the modal dialog is opened.
- Change line 40 to id instead of class
- Change line 54 to ('#opacity') instead (’.opacity’)
- Run the plugin
- The value of the slider will update correctly
- Dismiss the modal dialog
- Reopen the plugin
- The value of the slider will NOT update correctly