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条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效