Hi Saq,
I think you got me...I do not really know what the difference is.
I think all the js I did so far was macros.
I finally should learn some of the basic concepts of programming js in TW ;-) Thanks for giving me a hint to start.

Do I need a widget or can I perform that action with a macro.

Jan


Am 26.04.2020 um 01:31 schrieb Saq Imtiaz:
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  <http://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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3e58e2ff-7a57-4efd-8f04-0ba6ed5431de%40googlegroups.com <https://groups.google.com/d/msgid/tiddlywiki/3e58e2ff-7a57-4efd-8f04-0ba6ed5431de%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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/5EA54011.8090003%40googlemail.com.

Reply via email to