Barba: how to remove link listener

Created on 5 Aug 2016  路  4Comments  路  Source: barbajs/barba

Hi
How can I remove a "barba pjax listener" from a link ?
for example in Wordpress i would like to remove the listener from the wp admin bar links, i can not set the barba ignore class to those links so i think the best option is to remove the click listener on those anchors.

question

Most helpful comment

Then, if you want to ignore some links you can add the class .no-barba on the a tag.
Otherwise, you can replace the Barba.Pjax.preventCheck, adding your own logic control.

https://github.com/luruke/barba.js/blob/master/src/Pjax/Pjax.js#L207

All 4 comments

In your case you may just disable Barba.js Pjax is the user is logged as administrator:

if (window.ADMIN_BAR_VISIBLE) {
      Barba.Pjax.preventCheck = function() {
        return false;
      };
}

Of course you need to pass window.ADMIN_BAR_VISIBLE from wordpress;

i don't want to disable the pjax :)

Then, if you want to ignore some links you can add the class .no-barba on the a tag.
Otherwise, you can replace the Barba.Pjax.preventCheck, adding your own logic control.

https://github.com/luruke/barba.js/blob/master/src/Pjax/Pjax.js#L207

Nice, thank you !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shanewmurphy picture shanewmurphy  路  3Comments

EmilyChews picture EmilyChews  路  3Comments

S1SYPHOS picture S1SYPHOS  路  3Comments

iamtompickering picture iamtompickering  路  3Comments

khanprog picture khanprog  路  4Comments