20Apr

Stop smoothState on forms, deactivate SmoothState transition

SmoothState.js is a jQuery plugin for page transitions. It progressively enhances page loads to give us control over the page transitions.

SmoothState js validates forms and create page redirect errors

In my case, the problem was I used it for my newsletter form.

By default, the plugins applies to all links and also forms. To avoid a link to be part of it or in our case a form, simply add the blacklist class to you html form tag.
This class can be found in the plugin option blacklist. Default is .no-smoothState 

// Default
$('#main').smoothState({ blacklist: '.no-smoothState' });
<form class="no-smoothState" [...]

Easy fix.

Leave a Reply