• Resolved navyspitfire

    (@navyspitfire)


    I checked some other responses but couldn’t find what I am looking for. Just trying to swap images on rollover. Not sure why this code isn’t working.

    <div class="port-nav left">
    			<p class="prev"><?php previous_post_link('%link', '<img src="/wp-content/themes/starkers-child/img/LeftArrow_Idle.png" alt="Previous" />'); ?></p>
    			<p class="next"><?php next_post_link('%link', '<img src="/wp-content/themes/starkers-child/img/RightArrow_Idle.png" alt="Next" />'); ?></p>
    		</div>
    .port-nav {
    	margin: 2em 0 0 0;
    }
    
    .port-nav p {
    	display: inline-block;
    }
    
    .port-nav p:first-child {
    	margin-right: 0.5em;
    }
    
    .port-nav .next:hover {
    	background: url(/wp-content/themes/starkers-child/img/RightArrow_RollOver.png);
    	display: block;
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • check the image path in the CSS;
    if this is in a style.css in the child theme, try:

    background: url(img/RightArrow_RollOver.png);

    or try to use the full image url incl http://.....

    Thread Starter navyspitfire

    (@navyspitfire)

    Nope, not working. Image path is correct; I can see it load underneath the image, though, and not on top. I tried this code but couldn’t get it to work. Any thoughts?

    .port-nav {
    	margin: 2em 0 0 0;
    	position: relative;
    }
    
    .port-nav .next:hover {
    	background: url(/wp-content/themes/starkers-child/img/RightArrow_RollOver.png) no-repeat;
    	display: block;
    	position: absolute;
    	z-index: 999;
    }

    generally, afaik, you can’t swap a html image with a background image.

    possibly remove the html image, and try to add a background image to the :link and :hover …

    please post a live link where the problem can be inspected.

    for pure CSS isses, also consider to post in a CSS forum like http://csscreator.com/forum

    Thread Starter navyspitfire

    (@navyspitfire)

    <div class="port-nav left">
    			<p class="prev"><?php previous_post_link('%link'); ?></p>
    			<p class="next"><?php next_post_link('%link'); ?></p>
    		</div>
    .next a:link {
    	background: url(/wp-content/themes/starkers-child/img/RightArrow_Idle.png) no-repeat;
    	display: block;
    	width: 29px;
    	height: 29px;
    }
    .next a:hover {
    	background: url(/wp-content/themes/starkers-child/img/RightArrow_RollOver.png) no-repeat;
    	display: block;
    }
    
    .prev a:link {
    	background: url(/wp-content/themes/starkers-child/img/LeftArrow_Idle.png) no-repeat;
    	display: block;
    	width: 29px;
    	height: 29px;
    }
    .prev a:hover {
    	background: url(/wp-content/themes/starkers-child/img/LeftArrow_RollOver.png) no-repeat;
    	display: block;
    }

    So I got the link/hover to work, except that the html %link name displays on top of the image. Is there anyway to hide the actual link name?

    anyway to hide the actual link name

    possibly try:

    <p class="prev"><?php previous_post_link(' '); ?></p>

    etc…

    Thread Starter navyspitfire

    (@navyspitfire)

    Nope, images disappear.

    looking at the docu http://codex.wordpress.org/Function_Reference/previous_post_link#Text_As_Link.2C_Without_Post_Title.2C_Within_Same_Category, maybe try:

    <?php previous_post_link('%link', '&nbsp;'); ?>

    Thread Starter navyspitfire

    (@navyspitfire)

    Thanks for the help, a simple text-indent: -999px; works great.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Next post/prev post link image rollover’ is closed to new replies.