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.

Avatar Variable Problem

View previous topic View next topic Go down

In progress Avatar Variable Problem

Post by JAN2XONLINE on 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://illiweb.com/fa/pbucket.gif';
    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/.
avatar
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 on March 14th 2013, 10:17 am

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


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40177
Reputation : 2714
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Avatar Variable Problem

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

^
Not working sir.
avatar
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 on March 14th 2013, 10:30 am

Where did you add the HTML code?


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40177
Reputation : 2714
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Avatar Variable Problem

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

^
In a widget.
avatar
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 on 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



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

avatar
SLGray
Administrator
Administrator

Male Posts : 40177
Reputation : 2714
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE on 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.
avatar
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 on March 14th 2013, 10:40 am

So this will be a widget?


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40177
Reputation : 2714
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Avatar Variable Problem

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

^
Yap, just a widget.
avatar
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 on March 14th 2013, 10:48 am

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

Male Posts : 2262
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE on 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://illiweb.com/fa/pbucket.gif';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?
avatar
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 on 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.
avatar
LGforum
Hyperactive

Male Posts : 2262
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

In progress Re: Avatar Variable Problem

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

I tried def like this

Code:

$(function() {
    var sidebar = document.getElementById('right');
    var def = 'http://illiweb.com/fa/pbucket.gif';
    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.
avatar
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 on March 14th 2013, 11:54 pm

Is there no error anymore then?
avatar
LGforum
Hyperactive

Male Posts : 2262
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

In progress Re: Avatar Variable Problem

Post by JAN2XONLINE on 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
avatar
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 on March 16th 2013, 4:27 am

bump
avatar
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 on March 25th 2013, 12:02 am

BUMP!
avatar
JAN2XONLINE
Forumember

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

http://animeph.4umer.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