Jump to content

Turning the jQuery Overlay Tool Target Property into an Array


iwato

Recommended Posts

Background: I recently discovered how to overcome the problem of misapplied "rel" attributes when using the Overlay Tool in the absence of HTML tags with link attributes such as "href" and "src". The Overlay Tool has something called the "target" property that allows users to assign a link to the jQuery code that corresponds to the selector that activates the code. Now, the beauty of the "rel" attribute was that one could use the same selector to evoke the same functionality for different Overlay and trigger elements. One had simply to enter a different target value for the "rel" attribute of each trigger element and a different overlay would result. This, however, is not possible with target property, as there is only one target for each invocation of the same selector. Problem: My proposal is to create a target_array that would become the value of the Overlay Tool's target property whose individual elements could be accessed according to the activated trigger element. Unfortunately, I do not know whether the target property would accept such a value, let alone how to access the target property once the array has been created. Any suggestions? The following code fails due to the redundancy of the selectors and conflicting targets.

$(window).load(function() {  $("img[rel]").overlay({   effect:"apple"   });  $("em.EM_Overlay").overlay({   effect:"apple",   target:"#overlay_1_narrative"  });  $("em.EM_Overlay").overlay({   effect:"apple",   target:"#overlay_2_narrative"  });   ...    $("em.EM_Overlay").overlay({   effect:"apple",   target:"#overlay_N_narrative"   });});

Roddy :Pleased:

Edited by iwato
Link to comment
Share on other sites

You would need to look at the jQuery code or documentation to see how target is handled. You can change it if you want to accept an array and do whatever you want with that. It could also create a new attribute on the element and assign the target array to that so that you can retrieve it from the element later.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...