Function result undefined when accessed within another function

前端 未结 1 2025
青春惊慌失措
青春惊慌失措 2021-01-25 18:41

I\'m trying to get back the result of a function inside another one but always getting undefined:

$(window).load(function() {

   var isMobile = false;
      fun         


        
相关标签:
1条回答
  • http://jsfiddle.net/6jL64ave/2/ move those elements:

    var isMobile = false;
    $(window).resize(function() {
      resizeImage();
            console.log('wow')
    });
    function resizeImage() {
            console.log(isMobile)
            console.log('wow')
    }
    

    outside window load function

    0 讨论(0)
提交回复
热议问题