You can do this
linkify( 'h1 a' );
if you want to select by class you can use .
selector
linkify('a.myClass');
سؤال
I'm using this code in my website http://jsfiddle.net/hakim/Ht6Ym/
var supports3DTransforms = document.body.style['webkitPerspective'] !== undefined ||
document.body.style['MozPerspective'] !== undefined;
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i < len; i++ ) {
var node = nodes[i];
if( !node.className || !node.className.match( /roll/g ) ) {
node.className += ' roll';
node.innerHTML = '<span data-title="'+ node.text +'">' + node.innerHTML + '</span>';
}
};
}
}
linkify( 'a' );
I'm not very good at JS (fairly new) but at the end it targets all <'a'> tags:
linkify( 'a' );
However this is changing all links to this rollover effect. Is there anyway that I can target a specific class - lets call it .rolling - so that only the header is affected and not the other links?