2014-11-03 2 views
0

이 문제는 Firefox에서 작동하지만 Chrome에서는 'Uncaught TypeError : null'오류 'on'속성의 'css'속성을 읽을 수 없습니다. onDialogOpen() {this.iframe.css ({ "모달 창 안의 iFrame이 Chrome에서 작동하지 않습니다

function show(options) { 


    // create our temporary iframe 
    this.iframe = $('<iframe name="' + (this.id = 'emh_' + +new Date) + '">') 
     .load($.proxy(onIframeLoad, this)); 

    // show our dialog 
    this.iframe.dialog($.extend(true, { 
     title: 'Entity Viewer', 
     modal: true, 
     draggable: false, 
     resizable: false, 
     width: 800, 
     height: 500, 
     buttons: { 
     'Save & Continue': $.proxy(submitIframeForm, this) 
     }, 
     open: $.proxy(onDialogOpen, this), 
     close: $.proxy(onDialogClose, this) 
    }, options)); 
    alert(options.path); 
    // since our dialog is showing now, let's update the src of the iframe 
    this.iframe.attr('src', options.path + '?modal=true&unique=' + this.id); 


    } 

function onDialogOpen() { 
    this.iframe 
     .css({ 
     width: '100%', 
     padding: 0, 
     border: 0, 
     margin: 0 
     }); 
} 

답변

0

확실하지 않음이 작동하지만이 개 방법이있는 경우 :.

  1. 이동 onDialogOpen 쇼 방법 내부 :

    function show(options) { 
    
    //your code 
    //... 
    //... 
    //this.iframe.attr('src', options.path + '?modal=true&unique=' + this.id); 
    
    //no need to pass this parameter since method has same this as parent one 
    
        function onDialogOpen() { 
         this.iframe 
          .css({ 
          width: '100%', 
          padding: 0, 
          border: 0, 
          margin: 0 
          }); 
        } 
    

    }

또는

2.

- 바로 IFrame을로드 한 후이 참조를 만듭니다 :

개방 : $

var _this = this; 
  • 이 호출을 수정합니다. 프록시 (function() {onDialogOpen (_ this)} this)

    업데이트 onDialogOpen :

    function onDialogOpen(_this) { 
        if (typeof _this != 'undefined') 
    { 
    _this.iframe 
         .css({ 
         width: '100%', 
         padding: 0, 
         border: 0, 
         margin: 0 
         }); 
    } 
    else 
    { 
        this.iframe 
         .css({ 
         width: '100%', 
         padding: 0, 
         border: 0, 
         margin: 0 
         }); 
    } 
    } 
    
+0

SilentTremor 귀하의 의견 주셔서 감사하지만 불행히도 난 여전히 http://jsfiddle.net/pkxjmv9q/1/에게 코드에서 몇 가지 수정 –

+0

같은 오류가 점점 오전 : p가 작동합니다 지금 당장. – SilentTremor

관련 문제