Cannot read property 'sideBySide' of undefined #102

Closed
opened 2018-01-10 00:36:48 -05:00 by cpetro · 6 comments
cpetro commented 2018-01-10 00:36:48 -05:00 (Migrated from github.com)

I need to do some transitions between pages where the new content slides up over the old.

if i use this code https://unpkg.com/pjax/pjax.js and the switches example code then I get "Uncaught TypeError: Cannot read property 'sideBySide' of undefined".

Can you update https://unpkg.com/pjax/pjax.js so it works plz ! Thanks

I need to do some transitions between pages where the new content slides up over the old. if i use this code https://unpkg.com/pjax/pjax.js and the switches example code then I get "Uncaught TypeError: Cannot read property 'sideBySide' of undefined". Can you update https://unpkg.com/pjax/pjax.js so it works plz ! Thanks
BehindTheMath commented 2018-01-11 22:45:55 -05:00 (Migrated from github.com)

This issue should be already fixed in the repo.

We're currently actively working on fixing as many bugs as possible and closing old issues. When we're done, a new version will be pushed to NPM (which is where unpkg pulls from).

In the meantime, you can clone the repo and build it yourself by running npm run standalone.

This issue should be already fixed in the repo. We're currently actively working on fixing as many bugs as possible and closing old issues. When we're done, a new version will be pushed to NPM (which is where unpkg pulls from). In the meantime, you can clone the repo and build it yourself by running `npm run standalone`.
BehindTheMath commented 2018-02-02 11:46:34 -05:00 (Migrated from github.com)

Version 0.2.5 has been released to NPM.

Version 0.2.5 has been released to NPM.
jbrhel commented 2018-02-10 07:27:48 -05:00 (Migrated from github.com)

I'm still gettig this issue "Cannot read property 'sideBySide' of undefined", under version 0.2.5. Thank you in advance for your help.

I'm still gettig this issue "Cannot read property 'sideBySide' of undefined", under version 0.2.5. Thank you in advance for your help. <img width="630" alt="" src="https://user-images.githubusercontent.com/1133430/36062121-1ea7f54a-0e66-11e8-905c-c5cf5efd2de8.png">
robinnorth commented 2018-02-10 18:14:06 -05:00 (Migrated from github.com)

@jbrhel Can you post your code? Modifying example/example.js to use the sideBySide switch function works as expected under 0.2.5.

var pjax = new Pjax({
    elements: [".js-Pjax"],
    selectors: [".body"],
    switches: {
      '.body': Pjax.switches.sideBySide
    }
  })
@jbrhel Can you post your code? Modifying `example/example.js` to use the `sideBySide` switch function works as expected under 0.2.5. ``` var pjax = new Pjax({ elements: [".js-Pjax"], selectors: [".body"], switches: { '.body': Pjax.switches.sideBySide } }) ```
jbrhel commented 2018-02-17 04:42:08 -05:00 (Migrated from github.com)

@robinnorth Thank you for your comment. My code was:

 var main_pjax = new Pjax({
  cacheBust: false,
  elements: ['#aside a:not(.no-ajax), #content-header a, #nav a, .app-header a'],
  selectors: ['title', '#content-header', '#content-footer', '#content-main'],
  switches: {
    '#content-main': function(oldEl, newEl, options, switchOptions){
      this.switches.sideBySide.bind(this)(oldEl, newEl, options, switchOptions);
    }
  },
  switchesOptions: {
    '#content-main': switch_h_option
  }
});

So I replaced this by Pjax and it's working now.

@robinnorth Thank you for your comment. My code was: ``` var main_pjax = new Pjax({ cacheBust: false, elements: ['#aside a:not(.no-ajax), #content-header a, #nav a, .app-header a'], selectors: ['title', '#content-header', '#content-footer', '#content-main'], switches: { '#content-main': function(oldEl, newEl, options, switchOptions){ this.switches.sideBySide.bind(this)(oldEl, newEl, options, switchOptions); } }, switchesOptions: { '#content-main': switch_h_option } }); ``` So I replaced **this** by **Pjax** and it's working now.
robinnorth commented 2018-02-17 05:29:33 -05:00 (Migrated from github.com)

Hi @jbrhel, you're welcome! You can actually simplify your switches config even more to just

'#content-main': Pjax.switches.sideBySide

Hi @jbrhel, you're welcome! You can actually simplify your `switches` config even more to just `'#content-main': Pjax.switches.sideBySide`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#102