re: Using jQuery UI

42 views
Skip to first unread message

Jon

unread,
Jul 10, 2020, 11:59:05 AM7/10/20
to TiddlyWikiClassic

Hi, Shankar,

For some reason, your original post seems to have gotten corrupted and I can't reply to it, so I'll post my reply this way.

The only thing wrong with your implementation of jQuery UI is that you run the script to make the textarea draggable before the textarea exists! So at the time your script executes

jQuery('#draggable').draggable();

...there is no element with id=draggable for this to operate on. If you just move the whole <script>...</script> section below the <HTML>...</HTML> section, it works fine.

Note that you don't need the jQuery(function()... statement, all you need to make it work is one line jQuery('#draggable').draggable() -- or with var $ = jQuery as you've defined it, $('#draggable').draggable()

I would say that this is not a very efficient way to run jQuery UI: eval() of a long string is slow, and you'll have to do this in every tiddler where you want to use a jQuery UI function. It would be more efficient to put the jQuery UI code into a systemConfig tiddler and then you should be able to use it from anywhere.

With regard to your earlier question about ways to get draggable textboxes, I have had good luck using SortableJS for other purposes. It's intended for drag-and-drop lists, but there's no reason you couldn't put a textarea in a Sortable item. It plays well in TiddlyWiki.

--Jon

Shankar

unread,
Jul 11, 2020, 11:37:00 PM7/11/20
to TiddlyWikiClassic
Thank you, Jon.  I will follow up starting from your suggestions.

Cheers; 'best,
shankar
Reply all
Reply to author
Forward
0 new messages