The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

adding the profile link ...

4 posters

Go down

In progress adding the profile link ...

Post by Ahmed.K May 21st 2014, 10:00 am

I try to add the profile link to the new Avatar system, this code doesn't work, why, any ideas?

$('.tcr').each(function() {
        var src = document.querySelectorAll('.tcr strong a');
        var a = $("<a/>").attr("href", src);
        $(".lastpost-avatar img").wrap(a);
});
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

In progress Re: adding the profile link ...

Post by SLGray May 21st 2014, 12:07 pm

Are you trying to make the avatars clickable to load the profiles?


adding music - adding the profile link ... Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51519
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

In progress Re: adding the profile link ...

Post by SSYT May 21st 2014, 12:14 pm

Try:
Code:
$('.tcr').each(function() {
        var src = document.querySelectorAll('strong a', this);
        $(".lastpost-avatar img", this).wrap('<a href="'+ src +'" />');
});
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

In progress Re: adding the profile link ...

Post by Ahmed.K May 21st 2014, 2:05 pm

SLGray wrote:Are you trying to make the avatars clickable to load the profiles?
Yes.

InFeRn0 wrote:Try:
Code:
$('.tcr').each(function() {
        var src = document.querySelectorAll('strong a', this);
        $(".lastpost-avatar img", this).wrap('<a href="'+ src +'" />');
});

Doesn't work.
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

In progress Re: adding the profile link ...

Post by Ahmed.K May 22nd 2014, 8:07 pm

Still no ideas?
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

In progress Re: adding the profile link ...

Post by Ange Tuteur May 23rd 2014, 4:52 am

Hello Ahmed.K,

Here is a quick example I've written up :

Modules > Javascript codes management > create a new script

Title : your choice
Placement : in all the pages
Paste one of the codes below and submit :

For version PHPBB3 :
Code:
$(document).ready(function(){$('.row .lastpost').each(function(){$(this).find('.lastpost-avatar img').wrap('<a href="'+$(this).find('span strong a').attr('href')+'">')})});

For version PUNBB :
Code:
$(document).ready(function(){$('tr td.tcr').each(function(){$(this).find('.lastpost-avatar img').wrap('<a href="'+$(this).find('span strong a').attr('href')+'">')})});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: adding the profile link ...

Post by Ahmed.K May 23rd 2014, 11:26 am

Hi Ange,

There is a technical problem...
I use this code for auto refresh the forum index:
Code:
<script>
jQuery(document).ready(function() {
var refreshId = setInterval(function()
{
jQuery('#forum_index').load('/ #forum_index');
}, 20000);
jQuery.ajaxSetup({ cache: false });
});
</script>

So, the avatar profile-link code works just one time, and then doest work.
Is there any solution to this problem?
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Back to top

- Similar topics

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