Title: Mouseover code in a post
Last modified: February 7, 2017

---

# Mouseover code in a post

 *  [shadow](https://wordpress.org/support/users/shadow/)
 * (@shadow)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/mouseover-code-in-a-post/)
 * Hi,
    Does anyone happen to know of a simple means of using a mouseover script
   within a post? It only needs to be simple – just one for changing pics really.
   Thanks if anyone has one they know of… Edit: Oops – that should have been ‘hover’
   instead of mouseover…sorry 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/mouseover-code-in-a-post/#post-100840)
 * This is tricky isn’t it ?
    Using CSS would seem to be out as you would need to
   alter the css for each post that you wanted the effect and keep the modification
   there for archive views. So your css file gets larger. Not good. Using js would
   seem to be the way to go as you can include the main function in the `<head>`,
   but if you include the necessary code in a post, will it function ? And if it
   does, again, how will an archive view that involves multiple use of the function
   work ? It would certainly need a different variable name in each case – though
   using the filename is a way to do this. The only image rollover I’ve used is 
   over at [http://www.abody.co.uk/feature/index.html](http://www.abody.co.uk/feature/index.html)(
   View Source) but I’m not sure how – if at all – that could be split into a workable
   solution. There has to be a PHP solution to this !
 *  Thread Starter [shadow](https://wordpress.org/support/users/shadow/)
 * (@shadow)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/mouseover-code-in-a-post/#post-100842)
 * So my original comment that I might be able to find a simple solution was a bit
   presumptious? Silly me…
    I have been thinking all day about how to use the css
   somehow, and as you say Podz, it looks like it could be done but with a growing
   css as the result. The problem lies with the fact that we are talking about different
   images each time. Maybe someone will have a PHP option. It’s not so important
   but it would be handy. Thanks for looking into it Podz 🙂
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/mouseover-code-in-a-post/#post-100852)
 * I’ve just tried the js I linked to above – no go.
    For a start I had to turn 
   off the nesting correctly as that would break the js, but then the image wouldn’t
   swap, even when clicked. It has to be a js solution though – not php alone.
 *  [dss](https://wordpress.org/support/users/dss/)
 * (@dss)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/mouseover-code-in-a-post/#post-100883)
 * I wrote this up a little while ago:
    **2 parts**: 1. [the failed effort](http://fernando.dubtribe.com/archives/2004/09/13/using-css-and-java-for-hover-images/)
   2. [the success story](http://fernando.dubtribe.com/archives/2004/09/16/css-hover-images-revisited/)
   f.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Mouseover code in a post’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [dss](https://wordpress.org/support/users/dss/)
 * Last activity: [21 years, 8 months ago](https://wordpress.org/support/topic/mouseover-code-in-a-post/#post-100883)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
