The following code should only be called when the users mouse cursor enters the div element .post-entry
. By now, when I just refresh the page, I immediately receive the console.log enter and move.
app.uiController = {
init: function() {
// Development
console.log('init uiController');
var el = $('.entry .post-entry');
var dot = $('img');
// Call functions
$(el).on('mouseenter', app.uiController.mouseEnter());
$(el).on('mousemove', app.uiController.mouseMove());
},
mouseEnter: function() {
console.log('enter');
},
mouseMove: function() {
console.log('move');
}
}
app.uiController object will be called by the page by default. As mentioned before, mouse enter and move works immediately after the script is loaded, but I assigned the variable el
to the event, so when the mouse position enters .post-entry it should do the linked function.
What am I doing wrong?