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.

Avatar Variable Problem

3 posters

Go down

In progress Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 9:19 am

http://www.avacweb.com/t129-user-avatar-variable
^
I follow that tutorial but it is not working for me.

I'm using this JS script
Code:
$(function() {
    var sidebar = document.getElementById('right');
    var default = 'http://i855.photobucket.com/albums/ab117/jan2xonline/default_avatar_zpsa91409e3.jpg';
    if(!sidebar) return;
    var x = $('.module', sidebar)[0].getElementsByTagName('img');
    $('.AVATAR').html('<img src="' + (x.length > 0 ? x[0].src : default) + '">');
});

And this for the html
Code:
<span class="AVATAR">


testingggggggg</span>


I placed the "Log In" widget at the top right side of my forum so what's wrong?

Here's my forum, http://animeph.4umer.com/.
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by SLGray March 14th 2013, 10:17 am

Try changing the widget to the left and do not forget to change it in the JavaScript.


Avatar Variable Problem 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 : 51463
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 10:29 am

^
Not working sir.
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by SLGray March 14th 2013, 10:30 am

Where did you add the HTML code?


Avatar Variable Problem 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 : 51463
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 10:33 am

^
In a widget.
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by SLGray March 14th 2013, 10:34 am

What exactly are you trying to do with this tutorial? Did you read the last reply by LGForum? http://www.avacweb.com/t129p15-user-avatar-variable#10341



Avatar Variable Problem 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 : 51463
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 10:37 am

^
Yes and I'm not planning to make a last post avatar or avatar in chatbox. I'm just trying to make a custom user control panel sir.
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by SLGray March 14th 2013, 10:40 am

So this will be a widget?


Avatar Variable Problem 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 : 51463
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 10:46 am

^
Yap, just a widget.
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by LGforum March 14th 2013, 10:48 am

Have you checked that all your javascripts are error-free?
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 10:54 am

I tried to check the error console and got this

Code:

Failed to load resource http://an.z5x.net/ttj?id=1092879
Uncaught SyntaxError: Unexpected token default 23325.js:1

I clicked this "23325.js:1" and got this
Code:

$(function(){var sidebar=document.getElementById('right');var default='http://i855.photobucket.com/albums/ab117/jan2xonline/default_avatar_zpsa91409e3.jpg';if(!sidebar)return;var x=$('.module',sidebar)[0].getElementsByTagName('img');$('.AVATAR').html('<img src="'+(x.length>0?x[0].src:default)+'">')});

And that's the script for the avatar variable right?
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by LGforum March 14th 2013, 10:57 am

Change everywhere in the avatar script where it says 'default' to something else like 'def' or just give it a capital 'D' or something. There's 2 places where you'll need to change it.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 14th 2013, 11:00 am

I tried def like this

Code:

$(function() {
    var sidebar = document.getElementById('right');
    var def = 'http://i855.photobucket.com/albums/ab117/jan2xonline/default_avatar_zpsa91409e3.jpg';
    if(!sidebar) return;
    var x = $('.module', sidebar)[0].getElementsByTagName('img');
    $('.AVATAR').html('<img src="' + (x.length > 0 ? x[0].src : def) + '">');
});

and still not working sir.
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by LGforum March 14th 2013, 11:54 pm

Is there no error anymore then?
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 15th 2013, 12:33 am

^
The only error left in error console is this,
Code:
Failed to load resource http://an.z5x.net/ttj?id=1092879
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 16th 2013, 4:27 am

bump
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE March 25th 2013, 12:02 am

BUMP!
JAN2XONLINE
JAN2XONLINE
Forumember

Male Posts : 943
Reputation : 32
Language : Tagalog, English
Location : Alberta, Canada

http://animeph.4umer.com/

Back to top Go down

Back to top

- Similar topics

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