Forum Moderators: open
---
if ($.iPhone.present) {
}
else {
Shadowbox.init(options);
}
---
This prevents shadowbox from overriding the rel="shadowbox" attribute on a link. But I'd like to take it one step further, and have rel="shadowbox" convert the href to basically target="_blank", or use javascript to open it in a new window. This would effectively make the links open in new tabs for the iphone.
Does anyone know the jquery code to do this, or at least the code to identify all the links with rel="shadowbox" ?
Thanks in advance for your time!
rel: /^(light¦shadow)box/i, // rel attribute format
If I update that line to:
rel: /^nofollow (light¦shadow)box/i, // rel attribute format
Then it'll match rel="nofollow shadowbox". What I still can't figure out is how to make it accept rel="shadowbox" AND/OR rel="nofollow shadowbox".
Any ideas?
script type="text/javascript">
/*<![CDATA[*/ /*for valid xhtml*/
window.onload = function(){
var linksArray = document.getElementsByTagName("a");
for (var i = 0; i < linksArray.length; i++){
if (linksArray[i].rel === "shadowbox"){
linksArray[i].target = "_blank";
}
}
}
/*]]>*/
</script>
Place that in the head of a document and it will give a target="_blank" attribute to all links on the page with a rel="shadowbox" attribute.