Forum Moderators: open
"When you find all elements that have the rel attribute of 'popup,' instead of doing this:
// assigns a class so I can attach zoom conditionally for IE to solve 2 line problem
popups[i].className = "popup";
}
...add/append the following HTML and do it so that it ends up right before the closing <a> tag (like this: <a href="#" rel="popup">Link Text<span class="icon"> </span></a>):
<span class="icon"> </span>
Is there a javascript pro who can point me in the right direction? I tried another js forum but am running out of time for finding a solution.
(I'm using an adaptation of the script from the perfect popup tutorial from Ian Lloyd)
In place of this:
{
// assigns a class so I can attach zoom conditionally for IE to solve 2 line problem
popups[i].className = "popup";
}
...I inserted this:
{
var s = document.createElement('span');
s.className = 'icon';
s.appendChild(document.createTextNode(' '));
popups[i].appendChild(s);
}
Just wanted to make sure I did that part right. Had to add a closing parenthesis before the semicolon in the createtextnode line. Now, I only wish I understood this...
{
// Create a new span element with class 'icon'
var s = document.createElement('span');
s.className = 'icon';
// Put an empty text node inside the span
s.appendChild(document.createTextNode(' '));
// Append it to the end of the link
popups[i].appendChild(s);
}
That doesn't create an in the span, but I'm not sure you actually need one. See if this about works for you.