开发者

jQuery - Add Handler to jQuery Reel!

Hello!

I want to use this jQuery plugin http://jquery.vostrel.cz/reel I use stitched panorama. I works all great!

I need another handler for image animatio开发者_Go百科n because I have a transparent div over this panorama image, for more cool aspect.

I tried all css tricks but no luck, the handler activates only over the actual image. Can I specify another div to work as handler?

Thank you very much!


Adrian,

you can use the area option of .reel(). Whatever jQuery object is provided via area then becomes sensitive to user interaction.

For example having HTML similar to this (an image and some other DOM node anywhere in the document):

<img id="my_image" src="some_image.jpg" ... >
...
<div id="other_div">
   This DIV is also interactive
</div>

And including the area option:

$('#my_image').reel({
    area: $('#my_image, #other_div')
});

The resulting Reel instance will be user controllable by dragging both the image and the DIV (it can too be set to just the DIV alone if needed).

Happy Reeling!


I searched a lot for something really similar to this and after searching high and low found a way to do this.

$('#image').triggerHandler('frameChange',1546);

I called the function within the reel plugin which is supposed to reposition the image. I was running this from the document[dot]ready section after the reel plugin was initiated on the #image.

You can also create custom functions within the plugin and call them (which is what I was initially doing)

     cleanup.call(e);
    },
    repositionFrame: function(e, newF){
          set(_frame_, newF);
    }
},

and called it using

.triggerHandler('repositionFrame',1546);

You can also simply call the function using

.trigger('repositionFrame');

As you can understand the first one is used to pass parameters (for which you have to declare additional variables in the function declaration)

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜