![]() |
Setting rel on links with images
Hi,
My (vary basic) knowledge of Javascript tells me this should be fairly easy to do, but there's one bit I'm not sure of. I have a series of divs on a page with class "product-image" - I want all the links within each div to have the same rel, but the rel for each div should be unique. I know this would work, generally, if I wanted to add the same rel attribute to every link: Code:
<script type="text/javascript">It doesn't particularly matter what the rel is as long as it is unique, it could just be a random string. The reason I need this to happen automatically, rather than manually, is because the site will be managed by the user through a CMS, so I need to automatically attach the right functions. |
Code:
<script type="text/javascript">Code:
<script type="text/javascript"> |
If you want something unique on each you should be using id rather than rel - since rel is supposed to define the relationship that the item linked to has to the current page and as they are all lightboxes they should all have the same rel value. The id attribute is the one intended for assigning unique values to things in the page.
|
If you are adding information to each link then you could consider the jQuery data() method.
|
| All times are GMT +1. The time now is 12:42 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.