简体   繁体   中英

Javascript error on WordPress site

I'm trying to implement This to my web site. I did all things described as here . This is my site. As I can understand there is a problem with javascript.

This is the js code.

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();
})();  

Please be kind to check my website.You can see html from the site.I already wasted 4 hours for this.Your help will be highly appritiated.

Thanks.

Dhanuka

the original site I see the use of 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>

I see on your website using < div >

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM