Jump to content
Sign in to follow this  
iwato

Turning the jQuery Overlay Tool Target Property into an Array

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...