Anyone have a script that can scroll me to a spot then scroll be back to where I was?

Anyone have a script that can scroll me to a spot then scroll be back to where I was?

(Example: scroll to page 4, then return me to page 1. All on one button.)

]]>

5 Commentsto Anyone have a script that can scroll me to a spot then scroll be back to where I was?

  1. Anonymous says:

    < ![CDATA[

    Maybe something like this:


    – create a desktop bookmark to your target position


    – assign the following script to its on tap event (or any other event)


    (not tested, maybe there are syntax errors…)


    var item = LL.getEvent().getItem();


    var c = LL.getEvent().getContainer();


    var t = item.getTag();


    if(t) {


    var pos = JSON.parse(t);


    c.setPosition(pos.x, pos.y);


    item.setTag(null);


    } else {


    item.setTag(JSON.stringify({x:c.getPositionX(), y:c.getPositionY()}));


    item.launch();


    }

    ]]>

  2. Anonymous says:

    < ![CDATA[

    var page = -1; //page to jump to


    var time = 2 * 1000; //time to stay before returning



    var d = LL.getCurrentDesktop();


    var ox = d.getPositionX();


    var x = d.getWidth() * page;


    var y = d.getPositionY();


    // go to page


    d.setPosition(x, y);


    var func = function()


    // set return function


    {


    d.setPosition(ox, y);


    }


    // call return function with a timeout


    setTimeout(func, time);

    ]]>

  3. Anonymous says:

    < ![CDATA[

    But what if I don’t want it timed?


    Here’s another example. On some of werk’s themes he has a button that will take you to a certain spot, but pushing that same button also returns you to page 1.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    var origin = 0; //page to return to


    var page = -1; //page to jump to



    var d = LL.getCurrentDesktop();


    var ox = d.getWidth() * origin;


    var x = d.getWidth() * page;


    var y = d.getPositionY();


    // go to page


    if (d.getPositionX() == ox)


    d.setPosition(x, y);


    else


    d.setPosition(ox, y);




    Edit: did not test it but it should work. Page 0 is the center, negative to the left and positive to the right. Also works with fractional numbers. 

    ]]>

  5. Anonymous says:

    < ![CDATA[

    It worked. Thank you so much!

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *