friz
08-13-2010, 02:12 AM
Hi,
I've been using this script to open a page in a new window
function externalLinks() {
if (!document.getElementsByTagName && document.getElementById) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
<a href="http://alink.com" rel="external" class="menusubitem">A link name</a>
I wanted to add this script (http://flowplayer.org/tools/demos/overlay/external.html) for an overlay.
Javascript:
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: 'grey',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
<a href="apage.php" rel="#overlay">aPageName</a>
Separately they work fine. But combined the overlay script doesn't work anymore.
I'm guessing that's because they both use the "rel" attribute in the anchor??
If I delete the "rel" from the external link. The Overlay works again. But of course the external link doesn't work then. :rolleyes:
Is there a way to make both work on the same page?
Thank you in advance! :thumbsup:
I've been using this script to open a page in a new window
function externalLinks() {
if (!document.getElementsByTagName && document.getElementById) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
<a href="http://alink.com" rel="external" class="menusubitem">A link name</a>
I wanted to add this script (http://flowplayer.org/tools/demos/overlay/external.html) for an overlay.
Javascript:
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: 'grey',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
<a href="apage.php" rel="#overlay">aPageName</a>
Separately they work fine. But combined the overlay script doesn't work anymore.
I'm guessing that's because they both use the "rel" attribute in the anchor??
If I delete the "rel" from the external link. The Overlay works again. But of course the external link doesn't work then. :rolleyes:
Is there a way to make both work on the same page?
Thank you in advance! :thumbsup: