Skip to content

Link selector: exclude class #553

Answered by daun
drivebass asked this question in Help
Dec 19, 2022 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Update: since swup 3, you can use the ignoreVisit option to exclude links much more easily:

const swup = new Swup({
  ignoreVisit: (url, { el }) => el?.matches('.noswup, [data-no-swup]');
})

Previous answer for swup 2:

The selector is additive, so adding one rule at the end won't be enough. You'll need to add the :not() part after every selector, the same way it was done with data-no-swup. If you replace :not([data-no-swup]) with :not(.no-swup), you should be fine. The classname isn't supposed to have quote marks around it either way.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@drivebass
Comment options

@daun
Comment options

daun Dec 19, 2022
Maintainer

@drivebass
Comment options

@daun
Comment options

daun Dec 19, 2022
Maintainer

Answer selected by drivebass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #552 on December 19, 2022 11:14.