Adding Icon to all external links

Go down

Solved Adding Icon to all external links

Post by ioncube on November 8th 2011, 8:15 pm

I want to add an icon to all external links posted by users
@phpbb3
Here is my take, but it fails??
JS part
Code:

$(function() {

    $('.post').each(function(i) { //activated only in .post classes
        $("a:not([@href*=http://engineering.forumotions.info])").not("[href^=#]")

        /* get all <a> element that does not have "http://engineering.forumotions.info" and/or does not start with "#" in the href attribute */
        .addClass("external").attr({
            target: "_blank"
        }); //not necessary though...
    });


});

CSS
Code:
a.external {
   background: url(http://i49.servimg.com/u/f49/15/79/08/97/window10.gif) no-repeat;
   padding-left: 5px;
}

any solutions


.content will be more appropriate than .post class


Last edited by ioncube on November 9th 2011, 11:41 am; edited 1 time in total
avatar
ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Solved Re: Adding Icon to all external links

Post by ioncube on November 9th 2011, 10:06 am

any help....
another try

Code:
$(function() {
if (("a:not([@href*=http://www.webdesignerwall.com])").not("[href^=#]")) {
        $(".content a").addClass("external");
            }

});

...& plz remove this code prettify its buggy..
avatar
ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Solved Re: Adding Icon to all external links

Post by ioncube on November 9th 2011, 11:40 am

avatar
ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Solved Re: Adding Icon to all external links

Post by Nera. on November 9th 2011, 12:22 pm

ioncube duble posting is not tolerated unless separated by 24h. Please use the edit button. Wink

Topic solved
avatar
Nera.
Energetic

Female Posts : 7078
Reputation : 2015
Language : English
Location : -

http://webartzforum.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum