dongyan1491 2015-12-10 15:07
浏览 63
已采纳

如何在woocommerce中悬停在产品包装盒后显示添加到购物车按钮?

I have a problem when making a wordpress theme integrated with woocommerce like cannot show "add to cart" button when hovering a cursor in product box and only show when hovering a cursor to bottom in product box like GIF below: cannot show add to cart button

woocommerce.css

.woocommerce ul.products li.product .button {
    margin: 1em 0 3px 0.3em;
}

.woocommerce a.button {
    /* font-size: 100%; */
    /* margin: 0; */
    /* line-height: 1; */
    /* cursor: pointer; */
    position: relative;
    font-family: inherit;
    text-decoration: none;
    overflow: visible;
    padding: 0.618em 1.75em;
    font-weight: 700;
    /* border-radius: 3px; */
    /* left: auto; */
    color: transparent;
    background-color: transparent;
    /* border: 0; */
    /* white-space: nowrap; */
    /* display: inline-block; */
    /* background-image: none; */
    /* box-shadow: none; */
    /* -webkit-box-shadow: none; */
    /* text-shadow: none; */
}

.woocommerce a.button:hover {
    background-color: #f37020;
    text-decoration: none;
    color: #fff;
    background-image: none;
}

.woocommerce ul.products li:hover {
    border: 3px solid;
    border-color: #f37020;
}

How I can fix it?

UPDATED (Dec 11,2015):

Its my URL link: http://dev.galerigadget.com/shop/

  • 写回答

2条回答 默认 最新

  • donglinyi4313 2015-12-10 16:23
    关注

    Obviously your "add to cart" button is only displaying when you hover the lower part of the box. That indicates only the bottom area is linked. Your "a" element might need to be "display:block" so it covers the entire block inside the brown rule. Hard to tell without seeing the actual site. Can you post URL?

    AFTER EXAMINING YOUR CODE, HERE IS WHAT IS HAPPENING

    The add-to-cart link is there, even when not hovered.

    You do not see it b/c the CSS includes:

    color: transparent;
    background-color: transparent;
    

    I would remove those parameters so the button is visible in gray and white. Looks nice and tells the user where to click to purchase the item.

    You still have the hover effect that changes the button color to brown, but now the user clearly sees where to put their cursor.

    If you want the button 'hidden' until the box is hovered, and then turn brown when hovering the box, add this to your CSS:

    li:hover a.add_to_cart_button {
        background-color: #f37020; 
        text-decoration: none;
        color: #fff;
        background-image: none;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失