I am tryig to use hoverintent with a bigcommerce stencil theme and I cannot get ti to work.
Install the plugin
$npm install 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');
}
}
- Update 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();
}
}
This is the error that I get in the browser.
TypeError: $('.navigation-main li').hoverIntent is not a function. (In '$('.navigation-main li').hoverIntent(hoverOver, hoverOut)', '$('.navigation-main li').hoverIntent' is undefined)
I could not figure out how to get hover intent to work on bigcommerce stencil theme so I went with a pure css way. There are a few good tutorials online about this topic. Here is the on I referenced, by J. Hogue.
http://codepen.io/jhogue/pen/payuj