I trie to get the result of this function :
var isLaptop = false;
function is1024up() {
$(window).on('load resize', function() {
isLaptop = $(window).width() > 1024;
});
return isLaptop;
}
lap = is1024up(); // I put the result of my function in a global
I would like to use the result of this function on parameter of another function
function test(lap){
console.log(lap); //the result don't change on resize
if (lap) {
// my code here
}
}
My issue is on the resize function : I can get the result on is1024up()
when the page load but this result isn't uptable on resize.
Any idea ?