You have written a macro, not a widget. Look at one of the action widgets and write an action-totop widget, e.g: https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/action-deletetiddler.js
The invokeAction method is where the logic goes for what happens when the widget is triggered. On Saturday, April 25, 2020 at 8:40:56 PM UTC+2, Jan wrote: > > Hi, > I made a Landing-Page which uses its own Pagetemplate and hides the > storyriver: https://szen.io/Grid/ > The grid can be restructured by setting a tag to filter content. > When a user triggers this action, it would be great to scroll to the top > of the Webpage automatically. > How can I do this? > > Best wishes Jan > > Hi, > > I tried to build a widget, but so far it wont work. > > > > /*\ > title: $:/core/modules/macros/totop.js > type: application/javascript > module-type: macro > Macro that scrolls to the top > \*/ > > (function(){ > /*jslint node: true, browser: true */ > /*global $tw: false */ > "use strict"; > > /* > Information about this macro > */ > exports.name = "totop"; > exports.params = [ > ]; > /* > Run the macro > */ > exports.run = function() { > var totopp = window.scrollTo({ top: 0, behavior: 'smooth' }); > totopp; > } > })(); > > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3e58e2ff-7a57-4efd-8f04-0ba6ed5431de%40googlegroups.com.

