开发者

How to bind and trigger custom and native events in YUI?

I'm trying to bind and trigger the following events using YUI, however so far none of the events seem to fire when I trigger them.

My code to bind:

开发者_StackOverflow社区        YUI().use('node-base', function(Y){
            Y.one(el).on(event,callback);
        });

My code to trigger:

        YUI().use('node-event-simulate', function(Y){
            Y.one(el).simulate(event);
        });

The event variable can be any of the following strings:

  • statechange (custom event)
  • anchorchange (custom event)
  • hashchange (sometimes a native event, depends on browser features)
  • popstate (sometimes a native event, depends on browser features)

The el variable is usually the window dom element, though may also be selectors and other dom elements.

Here is my current attempt to get it working in YUI: http://jsfiddle.net/balupton/tFbum/

Here is what I want working in jQuery: http://jsfiddle.net/balupton/862Lg/

Thanks guys :-)


Looks like it is currently impossible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜