我正在尝试实现 This到我的网站。我做了所有描述为 here 的事情。 This is我的网站。据我了解,JavaScript 有问题。
这是js代码。
function init() {
var speed = 250,
easing = mina.easeinout;
[].slice.call ( document.querySelectorAll( '#offers_content > a' ) ).forEach( function( el ) {
var s = Snap( el.querySelector( 'svg' ) ), path = s.select( 'path' ),
pathConfig = {
from : path.attr( 'd' ),
to : el.getAttribute( 'data-path-to' )
};
el.addEventListener( 'mouseenter', function() {
path.animate( { 'path' : pathConfig.to }, speed, easing );
} );
el.addEventListener( 'mouseleave', function() {
path.animate( { 'path' : pathConfig.from }, speed, easing );
} );
} );
}
init();
})();
请检查我的网站。您可以从网站上看到 html。我已经为此浪费了 4 个小时。我们将非常感谢您的帮助。
谢谢。
达努卡
最佳答案
原来的网站我看到使用了html 5
<section id="grid" class="grid clearfix">
<a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
<figure>
<img src="img/1.png">
<svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M180,160C180,160,0,218,0,218C0,218,0,0,0,0C0,0,180,0,180,0C180,0,180,160,180,160"></path><desc>Created with Snap</desc><defs></defs></svg>
<figcaption>
<h2>Crystalline</h2>
<p>Soko radicchio bunya nuts gram dulse.</p>
<button>View</button>
</figcaption>
</figure>
</a>
</section>
我在您的网站上看到使用
<div id="offers_content" class="grid clearfix">
<!-- Ajax content here -->
<a style="" href="http://test.suxiid.com/playtrix/offers/sample-offer-7/" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z" class="offer-link col-xs-12 col-sm-6 col-md-3 col-lg-3 single-offer">
<figure>
<img src="http://test.suxiid.com/playtrix/wp-content/uploads/2014/08/offer-img.jpg">
<svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M180,160C180,160,0,218,0,218C0,218,0,0,0,0C0,0,180,0,180,0C180,0,180,160,180,160"></path></svg>
<figcaption>
<h2>Sample Offer 7</h2>
<p>Soko radicchio bunya nuts gram dulse.</p>
<button>View</button>
</figcaption>
</figure>
</a>
</div>
关于WordPress 网站上的 Javascript 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26342029/