question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hard reload on Barba.Pjax.goTo when using URL parameter

See original GitHub issue

I’ve seen the previous post #34 about the hard load on clicked elements.

But in my case, I’m not using a click element to trigger the page change but I use a “select” option with the “url” store in: `<select>

<option value="?category=apple">apple</option> <option value="?category=banana">banana</option> </select> ` upon change I trigger a `Barba.Pjax.goTo($(this).val())`

$('select').on('change', function(){ Barba.Pjax.goTo($(this).val()) })

Then I tried to adapt the code found on #34 but no chance… var links = document.querySelectorAll('option[value]'); var cbk = function(e) { if(e.currentTarget.value === window.location.href) { e.preventDefault(); e.stopPropagation(); } }; for(var i = 0; i < links.length; i++) { links[i].addEventListener('change', cbk); }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
psntrcommented, Oct 15, 2018

@luruke indeed, I had to finally changed the code logic now it’s working. Thank you for keeping us updated on the issue! Have a nice day

0reactions
colinorycommented, Nov 29, 2018

thanks @psntr ! I changed it to this:

I had some js errors because Barba.Dispatcher.on(‘linkClicked’, function(el) {)) was not enabled. And I use some of the data attributed from the clicked link. So solved it by adding so if’s.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How it works - Barba.js
This technique consist of preventing the normal link behavior, changing the browser url manually, and manually injecting the new content in the page....
Read more >
FAQ - barba.js
Frequently Asked Questions when starting using BarbaJS. Summary. Why Barba reload the page on same url? ... Use a prevent strategy to change...
Read more >
Barba.js (Pjax.js) and <head> replacing - Stack Overflow
I use barba.js to go through the pages without reloading and create a smooth animation. This is an example. And a short code...
Read more >
Implement barba.js with WordPress - Feras Jobeir
It fires when the new container has been loaded and injected in the wrapper. This function takes 4 parameters: currentStatus , prevStatus , ......
Read more >
Untitled
Huwei y200 hard reset, Cd equity client login, Sharpe's peril episode 2, Natural waistline ... #ponyta Niederaichbach, Tv tuner with hdmi input and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found