Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

How to make an image when mouse cursor is above it to be like clicked ?

(Jul 24, 2011 11:34 AM)Sezmic Wrote:  
Code
#examplediv:hover {
background-image: url('exampleimage.extension');
cursor: pointer;
}

CSS ftw.

This. CSS is your best bet.
idk use javascript?

<input type="image" src='example.jpg' onmouseover='this.src='new.pic'' onmouseout='example.jpg'>

Something like this?
This isn't a PHP-related question, obviously.

However, I always tend to use jQuery instead of CSS wherever I can.
I'm not really sure what you mean in your question. I'm gonna go with the obvious explanation and assume that you want to show an image whenever someone clicks on a link or whatever.

Code
<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function() {
    $("img#img").hide();
    $("a.showimage").click(function() {
    $("img#img").show();
    });
    });
</script>

<a href='#' class='showimage'>Show Image</a>
<img id="img" src="whatever.jpg" />
♣C∅DΣZ♣'s solution is the best and easiest, other guys are making it too complex.
You will just need to make an image from the original picture that looks as if it is "clicked" so like make it opaque and maybe add a contour so it seems as if it is a button that is being pushed down.

I suggest you look at: http://www.webdevelopersnotes.com/tutori...cript.php3

i believe i saw a good tut on it! i can pm you the link if i find it again


Possibly Related Threads...
Thread / Author Replies Views Last Post
[The Brotherhood] by VinavilMar 27, 2026 09:05 AM 25 860 Mar 27, 2026 09:05 AM
Last Post: Vinavil
[PHP] by Jack DrakeApr 14, 2019 09:42 PM 8 184 Apr 14, 2019 09:42 PM
Last Post: Jack Drake
[PHP] by EffexionFeb 12, 2019 03:34 AM 0 187 Feb 12, 2019 03:34 AM
Last Post: Effexion