blivesta / animsition

A simple and easy jQuery plugin for CSS animated page transitions.
http://git.blivesta.com/animsition
MIT License
3.83k stars 781 forks source link

Undefined URL when #129

Closed Factored-Dan closed 7 years ago

Factored-Dan commented 7 years ago

Hi guys.

I'm trying to integrate animsition with Wordpress. I've managed to animate the page in initially but when I try to navigate between pages, I get an undefined URL within Wordpress. Here's my JavaScript:

$(document).ready(function() {
  $('.animsition-overlay').animsition({
    inClass: 'overlay-slide-in-left',
    outClass: 'overlay-slide-out-left',
    linkElement: '.animsition-link',
    loading: true,
    loadingParentElement: 'body',
    loadingClass: 'animsition-loading',
    loadingInner: '',
    timeout: false,
    timeoutCountdown: 5000,
    onLoadEvent: true,
    browser: [ 'animation-duration', '-webkit-animation-duration'],
    overlay : true,
    overlayClass : 'animsition-overlay-slide',
    overlayParentElement : 'body',
    transition: function(url){ window.location.href = url; }
  });

Here's my navigation markup:

<li class="animsition-link menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-13 current_page_item menu-item-18" role="menuitem"><a href="//localhost:3000/factored_twenty_seventeen_wordpress/">Home</a></li>
<li class="animsition-link menu-item menu-item-type-post_type menu-item-object-page menu-item-273" role="menuitem"><a href="//localhost:3000/factored_twenty_seventeen_wordpress/?page_id=15">About</a></li>

And here's my html markup:

<div class="animsition-overlay">

I've added some screenshots too.

Your help would be greatly appreciated.

screen shot 2017-07-10 at 15 44 58
Factored-Dan commented 7 years ago

For anyone wondering, I've resolved the 'undefined' issue. This is due to a mis-configuration on my behalf. The linkElement selector was incorrect. It should have been:

linkElement: '.animsition-link a'

The linkElement option selector must use a a href type.