Jump to content

Click-to-show


Eminem

Recommended Posts

Javascript is what you want with the document DOM and CSS styles. This is posted in the wrong forum. Should be Javascript.

 

Is there a way to get Javascript into a php file? Should I do this:

 

<php?

phpcodehere
?>

javascript

<php?

 

 

Link to comment
Share on other sites

Your problem can be solved with DIV layers...

 

Instead of href use onClick or onMouseOver (up to you ... what you like most) and onClick call JS ...

 

You should define div layer with height '0' and positioning to absolute and overflow should be disabled.

 

In JS you should resize this layer to whatever you want..

 

With a little knowledge about JS you should understand code below:

 

<script type="text/javascript">
var o;
function big(n, obj)
{
setTimeout('bigcall("'+n+'")', 0);
}
function bigcall(n)
{
	var obj = document.getElementById('im');
	o.innerHTML = '<img src="'+n+'" />';
	o.style.left = (obj.offsetWidth - 10) + "px";
	o.style.top = (obj.offsetHeight - 10) + "px";
	o.style.visibility = 'visible';		
}

function big_hide()
{
setTimeout('big_hide1()', 1000);
}

function big_hide1(num)
{
o.style.visibility = 'hidden';
}

function init()
{
o = document.getElementById('ro');
}
</script>

 

This is made for pictures:

"bigcall('path_to_picture')" Use this in onClick to call function bigcall...

 

In body must be defined:

onload="init();"

 

This will make o (look in script)..

 

And div layer must be defined with ID (in this case 'ro')

<div id="ro" style="visibility:hidden; position:absolute;"></div>

 

With this script you should solve your problem with a few modifications.

 

In function bigCall there is timeout function ... This is used if you want a little delay when mouse goes over.

 

If you have any problems feel free to ask...

 

This code is just a quick example.. I hope it will help you...

 

Best regards,

EW

Link to comment
Share on other sites

Something that probably complicates the situation is the fact that I want to be able to click a user's avatar in an SMF Forum to show the personal text, custom profile field, country flag, personal text, and other stuff that goes under the user's avatar in the post.

Link to comment
Share on other sites

Although I don't imagine what exactly you want to do I think it can be easily done ...

 

Text should be hidden and in div (same div as picture) than on click text should be set to proper size and shown and layer should be set to auto width and height ...

 

You can describe a little bit more (is there any example, picture) and I will help tomorrow (will be away now - sleep time :) ) if you are not successful today. 

 

Best regards

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.