we're busy writing an portfolio kind of plugin.
We need to know how we can let the script know what the size of the screen is everytime the page loads en after the window is getting resized. At the moment when the user is moving the mouse the window-size is calculated over and over. We only want this when the page is loaded for the first time and after it's resized.
What would be the best solution? Thanks!
$(document).on("mousemove", function (event) {
var mouseposX = event.pageX;
var mouseposY = event.pageY;
windowX = $(window).width();
windowY = $(window).height();
offsetX = Math.round(-(mouseposX / windowX * (blokjeContainerWidth - windowX)));
offsetY = Math.round(-(mouseposY / windowY * (blokjeContainerHeight - windowY)));
});
This is the link to the example : portoflio