> From: Dan G. Switzer, II
> 
> What is this "glossy" plug-in your using?
> 
> I have a feeling that plug-in may be changing your images 
> from normal <img /> HTML tags to something embedded in a 
> <canvas /> tag or to SVG. 
> 
> If that's the case, then it's definitely going to affect 
> jQuery--because the images are no longer HTML components 
> (plus, those elements would no longer exist in the DOM.)

That is exactly what glossy does - it converts the buttons to canvas
elements, or VML for IE:

http://www.netzgesta.de/glossy/

You may possibly be able to use jQuery event handling with glossy buttons,
*if* you bind the events after glossy converts them.

Glossy does try to copy click event handlers from the original element to
the canvas/VML element, but it only works for event handlers that were
attached via the 'onclick' attribute. You'll see this code in the glossy
source:

 For IE:
 if(image.getAttribute('onclick')!='')
vml.setAttribute('onclick',image.getAttribute('onclick'));

 For other browsers:
 if(image.getAttribute('onclick')!='')
canvas.setAttribute('onclick',image.getAttribute('onclick'));

But jQuery doesn't use 'onclick'. It uses the DOM methods - attachEvent or
addEventListener - to attach the events. Glossy ignores these and therefore
loses them when it converts the elements.

Glossy does preserve the id attribute when it converts an element, so you
could probably attach a jQuery event using a #id selector after the element
is converted. It looks like it also preserves additional classes, so a
.class selector would probably work too. But you would have to do this after
glossy converts the element.

-Mike

Reply via email to