• Heya – so I’m working on this site: https://jen-novak-consulting.theportlandco.com

    And the image that appears in the top right needs to change based on which category the user is rolled over on. (The categories are listed in the middle column).

    I would use this code:

    <head>
    <script language="javascript" type="text/javascript">
    normal_image = new Image();
    normal_image.src = "images/sample-3.png";
    
    mouseover_image = new Image();
    mouseover_image.src = "images/websites.png";
    
    function swap() {
    	if (document.images) {
    		for (var x=0;
    		x<swap.arguments.length;
    		x+=2) {
    			document[swap.arguments[x]].src = eval(swap.arguments[x+1] + ".src");
    		}
    	}
    }
    </script>
    </head>
    
    <body>
    <a href="" onMouseOver="swap('name_of_img','normal_image')"
    onMouseOut="swap('name_of_img','mouseover_image')">example</a>
    </body>

    But I can’t seem to figure out how to append the onMouseOver/onMouseOut to this:

    <?php wp_list_categories('&title_li='); ?>

    Which is what lists my links. Does anyone have any experience or solutions? Thanks!

  • The topic ‘How can I implement rollover images for my WordPress categories?’ is closed to new replies.