【发布时间】:2017-08-26 10:03:11
【问题描述】:
我已经尝试了一些东西,但现在,我想淡出改变背景位置和淡入但不工作....有什么想法吗?还是更好的解决方案?
$('.collection-hover a').on("mouseenter touchstart", function(event) {
$(this).find('.collection-list-hover-desc').fadeIn(1000);
$(this).animate({backgroundPosition: "-50% 100%"});
});
$('.collection-hover a').on("mouseleave touchend", function(event) {
$(this).find('.collection-list-hover-desc').fadeOut(1000);
$(this).animate({backgroundPosition: "0 0"});
});
html的sn-p
<li class="collection-list-item grid-item first collection-hover">
<a href="/collections/butterfly-sofa" class="position-left" data-image="//cdn.shopify.com/s/files/1/1839/7697/collections/category-panel-butterfly.jpg?v=1491014401" style="background-image: url("//cdn.shopify.com/s/files/1/1839/7697/collections/category-panel-butterfly.jpg?v=1491014401"); height: 108.009px;">
<div class="collection-list-hover-desc">
<p>Dein eigener Ruhepol in einer hektischen Welt. Der durch eine Struktur im Inneren formstabile Sitzsack vereint Komfort und Ästhetik.</p>
</div>
<div class="collection-list-hover-button">
<span class="button" style="
padding: 5px 8px;
">Entdecken</span>
</div>
</a>
</li>
【问题讨论】:
-
你的html在哪里?
-
能否提供一些html代码,如果您可以通过单击将html、css和jQuery包含在一个html模块中,这样其他s可以更容易地提供帮助
-
添加了 html 的 sn-p
-
这可能会有所帮助。 stackoverflow.com/questions/7622822/make-background-fade-out-in>
标签: javascript jquery html css