hs.isUnobtrusiveAnchor
Determine whether the given element is an unobtrusively marked up Highslide anchor.
string hs.isUnobtrusiveAnchor( DOMElement el )
By default, when Highslide is used in unobtrusive mode, the rel attribute of a HTML anchor is used to mark it up to be processed by Highslide. The rel attribute can be 'highslide' for images, 'highslide-ajax', 'highslide-iframe' or 'highslide-swf'. This is recognized in the hs.isUnobtrusiveAnchor function. By creating your own function instead of this and return 'image', 'ajax', 'iframe' or 'swf', you can make Highslide recognize all kinds of links for processing.
Details
Requires |
unobtrusive |
Type |
function |
Returns |
string |
Parameters
- el
- The DOM element to inspect.
Example
Make all image links on the page open in Highslide
Make a function that returns 'image' if the link's href points to a .jpg image. Put this code in the head section of your page or in a separate JavaScript file:
hs.isUnobtrusiveAnchor = function(el) {
if (el.href && /\.jpg$/.test(el.href)) {
el.className = 'highslide'; // for the zoom-in cursor
return 'image';
}
}
Now we try it out on this link:
<a href="../samples/full1.jpg">This is a simple link to an image</a>
The effect: This is a simple link to an image.
See also