Title: Position problem with hover
Last modified: October 22, 2019

---

# Position problem with hover

 *  Resolved [mrced](https://wordpress.org/support/users/mrced/)
 * (@mrced)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/position-problem-with-hover/)
 * Hi,
    I have a problem with menu image. All my images are in wrong position with
   hover effect. I took a look at the code and I have a question : In function menu_image_nav_menu_item_title_filter(
   ligne 508 in menu-image.php) There is those lines :
 * if ( $item->thumbnail_hover_id ) {
    $this->setUsedAttachments( $image_size, $
   item->thumbnail_hover_id ); $hover_image_src = wp_get_attachment_image_src( $
   item->thumbnail_hover_id, $image_size ); **$margin_size = $hover_image_src[1];**
   $image = “<span class=’menu-image-hover-wrapper’>”; $image .= wp_get_attachment_image(
   $item->thumbnail_id, $image_size, false, “class=menu-image {$class}” ); $image.
   = wp_get_attachment_image( $item->thumbnail_hover_id, $image_size, false, array(‘
   class’ => “hovered-image {$class}”, **‘style’ => “margin-left: -{$margin_size}
   px;”,** ) ); $image .= ‘</span>’; }
 * So, the margin_size is equal to the hover image size.
    This not working when 
   I put only an image (with hover) without text because the margin-left is (- *
   image size*)px. I have made a little modifcation to resolve the problem in my
   case :
 * if ( $item->thumbnail_hover_id ) {
    $this->setUsedAttachments( $image_size, $
   item->thumbnail_hover_id ); $hover_image_src = wp_get_attachment_image_src( $
   item->thumbnail_hover_id, $image_size ); **$margin_size = ($hover_image_src[1])/
   2 + ($hover_image_src[1])\*0.033;** $image = “<span class=’menu-image-hover-wrapper’
   >”; $image .= wp_get_attachment_image( $item->thumbnail_id, $image_size, false,“
   class=menu-image {$class}” ); $image .= wp_get_attachment_image( $item->thumbnail_hover_id,
   $image_size, false, array( ‘class’ => “hovered-image {$class}”, ‘style’ => “margin-
   left: -{$margin_size}px;”, ) ); $image .= ‘</span>’; }
 * It works perfectly but I have to make this modification frequently…
    Is there
   any way to put the modification in functin.php ?
 * Thanks a lot
 * Cédric ( sorry for my english, I’m french)

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

 *  Plugin Author [Rui Guerreiro](https://wordpress.org/support/users/takanakui/)
 * (@takanakui)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/position-problem-with-hover/#post-12062672)
 * Hi [@mrced](https://wordpress.org/support/users/mrced/),
 * What is your site URL so we can have a look?
    Thanks
 *  Thread Starter [mrced](https://wordpress.org/support/users/mrced/)
 * (@mrced)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/position-problem-with-hover/#post-12095399)
 * Hi Rui,
    Thanks for your message. Here is an URL : [https://www.bigre-magazine.fr/articles/](https://www.bigre-magazine.fr/articles/)
   I have put your original code and the problem is visible with hover above ‘articles’
   menu.
 * Ced
 *  Plugin Author [Rui Guerreiro](https://wordpress.org/support/users/takanakui/)
 * (@takanakui)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/position-problem-with-hover/#post-12107505)
 * Hi [@mrced](https://wordpress.org/support/users/mrced/),
 * thank you for your patience. Is the plugin active?
    I can’t see it in action 
   or the issue.
 *  Plugin Author [Rui Guerreiro](https://wordpress.org/support/users/takanakui/)
 * (@takanakui)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/position-problem-with-hover/#post-12210437)
 * Will close the topic for now.

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

The topic ‘Position problem with hover’ is closed to new replies.

 * ![](https://ps.w.org/menu-image/assets/icon-128x128.png?rev=2123398)
 * [Menu Image, Icons made easy](https://wordpress.org/plugins/menu-image/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/menu-image/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/menu-image/)
 * [Active Topics](https://wordpress.org/support/plugin/menu-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/menu-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/menu-image/reviews/)

 * 4 replies
 * 1 participant
 * Last reply from: [Rui Guerreiro](https://wordpress.org/support/users/takanakui/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/position-problem-with-hover/#post-12210437)
 * Status: resolved