Trigger events
-
Hello, Benbodhi, cheers for the cool plugin!
I was thinking that you could implement some custom jQuery events so that we know when it’s done loading and changing the images.
My use case is that I want to JS control the SVG but it will work only after it’s been replaced.Not sure if this is the best way to do it but it works and looks nice!
jQuery(document).trigger('loaded.svg');
Probably for a best usability you should create and id (if the imgID isn’t there) and pass it along like:
jQuery(document).trigger('loaded.svg', [imgID]);
So we can know for sure which image has already loaded.
On my scripts file I can:$(document).on('svg.loaded', function(event, id){ console.log(id); });
Of course I had to change a bit more on the function to ensure that the id existed either on the img or on the svg element.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Trigger events’ is closed to new replies.