ReferenceError:即使定义了函数,也未定义函数

时间:2016-04-11 18:59:42

标签: javascript jquery

我无法理解此错误并将其删除。

当我调整屏幕大小时从firefox开发工具中看到:

ReferenceError: checksize is not defined

我不明白为什么firefox说我的功能没有定义。这很奇怪......

// Display info on cards hover or click according to view
  $(document).on('page:change', function () {
    $('#collapseOne').on('shown.bs.collapse', function () {
      $(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
    });
    $('#collapseOne').on('hidden.bs.collapse', function () {
      $(".glyphicon").removeClass("glyphicon-minus").addClass("glyphicon-plus");
    });

    // run on initial page load
    checkSize();
    // on screen resize
    window.addEventListener('resize',function () {
      console.log('Resize of screen has been identified');
      // All the taxing stuff you do
      checksize();
    });

     function checkSize() {        
        // Use jquery intent to prevent ???
        // Source-stackoverflow.com/questions/1089246/how-to-tell-hover-to-wait &
        // cherne.net/brian/resources/jquery.hoverIntent.html
        $(".card-image").hoverIntent({
            sensitivity:100,//sensitivity threshold (must be 1 or higher)    
            interval:100,//milliseconds for onMouseOver polling interval    
            timeout:100,//milliseconds delay before onMouseOut    
            over:function(){
              $('.card-short-info',this).slideToggle(100);
            },
            out:function(){
              $('.card-short-info',this).slideToggle(300);
              // remove behind the scene appearance on small screen that would linger when moving to large screen

            }
        });

      }

    });

2 个答案:

答案 0 :(得分:2)

Javascript区分大小写。

您需要S

答案 1 :(得分:0)

从$(document)块中取出checkSize()的定义。