2015-02-02 1 views
1

ajax fancybox를 클릭하면 로더 오버레이가 표시됩니다. 그러나 항상 fancybox 클래스가 추가되었습니다.Fancybox2 원하지 않는 fancybox-margin 클래스가 추가되었습니다.

여기는 fiddle입니다.

<div class="loading hide">Loading&#8230;</div> 
<a class="fancybox fancybox.ajax" href="http://fancyapps.com/fancybox/demo/1_b.jpg"> 
    click me 
</a> 

$('.fancybox').fancybox({ 
    beforeLoad: function() { 
     $('.loading').removeClass('hide'); 
    }, 
    beforeShow: function() { 
     $('.loading').addClass('hide'); 
    } 
}); 

당신이 결과에 링크 표시 소스를 클릭

fancybox-margin 추가가있다. .loading 요소가있을 때

이 클래스

에만 추가됩니다 position:fixed

나는이 클래스를 추가하지 fancybox를 알 수있는 방법이 있나요?

답변

2

원본 fancybox js 파일을 해킹하지 않아도됩니다. 그렇게하면 새 버전을 업데이트 한 날에 다시해야합니다.

그냥 잘 작동, 사용자 정의 fancybox 초기화 스크립트를 당신에게 옵션

helpers: { 
    overlay: { 
     locked: false 
    } 
} 

클래스fancybox-margin가 추가되지 않습니다

+0

감사를 추가합니다. –

1

소스 만 수정하십시오. 제거 이러한 라인 (1833에서 1835 사이) :

   $('*').filter(function(){ 
        return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap")); 
       }).addClass('fancybox-margin'); 
0

당신은 Fancybox의 코드를 보면 다음과 같은 주석 수 있습니다

if (this.margin !== false) { 
    $('*').filter(function(){ 
    return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap")); 
    }).addClass('fancybox-margin'); 

    this.el.addClass('fancybox-margin'); 
} 

을하지만 용을 조심 -이가 어떤 영향을 미칠 것인가 아무 생각이 없다 pop-up의 배치.

아마도 css 파일을보고 inspector를 가지고 노는 것이 더 좋을 것입니다.