簡體   English   中英

無法在window.resize()中訪問對象的上下文

[英]Can't access an object's context in window.resize()

我可以在其他方法中以這種方式處理上下文,但是我不確定.resize()有什么不同,或者不確定為什么無法在上下文中傳遞。

 D4.prototype.resize = function() {
    var that = this;
    that.containerBound = that.getBound(that.containerId);
    // that is referring to the DomWindow and not D4

  };

  $(window).resize(D4.prototype.resize);

你有沒有嘗試做這樣的

$(window).resize(function() {
    D4.prototype.resize('prototype:');
    myD4.resize('instance:')
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM