Je suis tryig pour utiliser hoverintent avec un thème stencil bigcommerce et je ne peux pas obtenir ti pour travailler.Ajouter hoverintent au thème Stencil Bigcommerce
Installez le plug-in
$ installer NPM hoverintenthoverintent.js
/assets/js/theme/global/hoverintent.js
import request from 'hoverintent';
export default function() {
$(function() {
$('.navigation-main li').hoverIntent(hoverOver , hoverOut);
});
// expand the height of the container
function hoverOver(){
$(this).addClass('js-hover');
}
// reset the height of the container
function hoverOut() {
$(this).removeClass('js-hover');
}
}
- Mise à jour global.js
/assets/js/theme/global.js
import $ from 'jquery';
...
import hoverIntent from './global/hoverintent';
...
export default class Global extends PageManager {
loaded(next) {
...
hoverIntent();
next();
}
}
C'est l'erreur que je reçois dans le navigateur. TypeError: $ ('. Navigation-main li') hoverIntent n'est pas une fonction.
(Dans '$ ('. Navigation-main li ') hoverIntent (hoverOver, hoverOut)', '$ ('. Navigation-main li '). HoverIntent' est indéfini)