2013-02-26 2 views
2

모두 나는 Draggable 봉쇄 옵션이 다음과 같은 문자열 값을 설정할 수 있음을 알고 있습니다.Jquery 드래그 가능한 봉쇄 문자열 값

Parent (현재 요소의 부모 요소 경계 내로 끌어 오는 제한), windowdocument입니다.

그러나 나는 windowdocument 값의 차이점을 알지 못합니다. 이 두 값에 대한 API 문서를 찾지 못했습니다. 그것을 이해하도록 도와주세요. 감사합니다.

답변

1

이것은 모두 difference between window and document에 이릅니다. 당신은 드래그의 containment으로 설정하면, jQuery를은 (읽기 쉽도록 포맷) the sources 쇼로, 그 경계를 결정하기 위해 둘 중 하나의 widthheight 속성을 사용

if(o.containment == 'document' || o.containment == 'window') this.containment = [ 
    0 - this.offset.relative.left - this.offset.parent.left, 
    0 - this.offset.relative.top - this.offset.parent.top, 
    $(o.containment == 'document' ? document : window).width() - 
     this.helperProportions.width - this.margins.left, 
    ($(o.containment == 'document' ? document : window).height() || 
     document.body.parentNode.scrollHeight) - this.helperProportions.height - 
     this.margins.top 
]; 

iframe들, 그 다음이없는 경우 I 두 차원 모두 같을 것입니다. 그렇지 않으면, 상황이 약간 다를 수 있습니다 (jQuery가 동일한 출처에서라도 iframe 사이의 끌어서 놓기를 지원하는지 확신 할 수 없지만).

+0

감사합니다. mgibsonbr, 나는이 두 설정이 동일하다고 생각합니다. 어쨌든, 나는'parent' 또는'array' 설정이 사용하기에 충분하다고 생각합니다. –

관련 문제