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 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么