Hard reload on Barba.Pjax.goTo when using URL parameter
See original GitHub issueI’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:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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
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.