The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Adding Icon to all external links

View previous topic View next topic 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

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..

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


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

Nera.
Energetic

Female Posts : 7077
Reputation : 2013
Language : English
Location : -

http://webartzforum.com

Back to top Go down

View previous topic View next topic Back to top


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