on stepEnter doesn't work with data-delegate

25 views
Skip to first unread message

Hans Fast

unread,
Dec 4, 2013, 3:24:55 AM12/4/13
to jmpr...@googlegroups.com
Hi,

When I try to use the event 'stepEnter' on a delegated step it doesn't work.
in the documentation I read that using data-delegate transfers 'activeness' to the named step. Is this the reason? Is there a way to catch the event of the delegating step?

The use case: I have a step with a map that I want to visit several times, and I want to zoom the map or change its layers depending on where I'm coming from; I thought using delegated slides would be a way to reuse the same map but change it differently each time (this is also why I can't use the event of the map step itself).

thanks

hans

Tobias Koppers

unread,
Dec 4, 2013, 3:49:34 AM12/4/13
to jmpress.js
Check the implementation of the jquery events: https://github.com/jmpressjs/jmpress.js/blob/master/src/components/jqevents.js

eventData contains a property "delegatedFrom" which points to the original step.

Here is a implementation of a "new" jquery event which fires on the delegated step

        $.jmpress("setActive", function( step, eventData ) {
                $(eventData.delegatedFrom).triggerHandler("enterStepDelegated");
        });
        $.jmpress("setInactive", function( step, eventData ) {
                $(eventData.delegatedFrom).triggerHandler("leaveStepDelegated");
        });


2013/12/4 Hans Fast <fast...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "jmpress.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jmpressjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hans Fast

unread,
Dec 4, 2013, 4:17:24 AM12/4/13
to jmpr...@googlegroups.com, tobias....@googlemail.com
That looks good! I'll look into that. Thank you.
Reply all
Reply to author
Forward
0 new messages