tags:

views:

21

answers:

2

hi,

wrote a little jquery gallery plugin and i'm initializing like this: myDiv.tGallery();

my question: is it possible to have jQuery detect if the HTML markup contains gallery code (eg. defined by its classname .myPlugs_gallery) and auto-apply the plugin code?

currently i'm having a global init-routine which goes like $(".myPlugs_tGallery").tGallery();

i was thinking about some kind of dynamic jQuery statement like: "apply plugincode to all divs which start with classname "myPlugins"

so there would be just one command for all my future plugins.

any ideas how to do it? thanks

+1  A: 

Add an initialization block to your plugin .js file:

$(function() {
  $('div.myPlugs_gallery').tGallery();
});
Pointy
A: 

try this with if statment

$('div:eq(.myPlugs_gallery)')
zapping