jquery-plugins
  • jquery-mobile
  • phonegap-plugins
  • photoswipe
  • 2012-06-14 4 views 2 likes 
    2

    내 갤러리와 관련있는 임의의 데이터에 따라 일부 이미지 조작 작업을 수행하려고합니다.jquery-mobile 인터페이스를 사용하여 photoswipe에서 이벤트 핸들러를 사용하는 방법

    gallery.html(''); 
        $.each(data.photos, function(key, photo) { 
    
         var item = "<li><a href='http://stage.domain.com/assets/img/user/"+photo.full+"'><img src='http://stage.domain.com/assets/img/user/"+photo.med+"'/></a></li>"; 
    
         gallery.append(item); 
        }); 
        gallery.trigger('create'); 
    
        var options = { 
    
    
         enableMouseWheel: false , 
         enableKeyboard: false , 
         captionAndToolbarAutoHideDelay:0, 
         jQueryMobile:true 
    
        } 
    
        var swipe = $(".gallery a").photoSwipe(options); 
    
        // onDisplayImage 
        swipe.addEventHandler(PhotoSwipe.EventTypes.onDisplayImage, function(e){ 
         console.log('onDisplayImage{'); 
         console.log('onDisplayImage - e.action = ' + e.action); 
         console.log('onDisplayImage - e.index = ' + e.index); 
         console.log(swipe.getCurrentImage()); 
         console.log('onDisplayImage}'); 
        }); 
    

    그러나 ondisplayimage 이벤트가 PhotoSwipe beacuse 해고되지 않습니다는

    06-14 04:28:45.496: D/CordovaLog(31662): Uncaught ReferenceError: PhotoSwipe is not defined 
    

    내가 필요하다 JQuery와 구현을 사용하지 않는 https://github.com/codecomputerlove/PhotoSwipe/blob/master/src/examples/07-custom-toolbar.html 예제

    를 정의되어 있지 않습니다. 그래서 기본적으로 jquery 모바일을 사용하여 이벤트 핸들러에 어떻게 연결해야합니까?

    답변

    6

    변경 :

    swipe.addEventHandler(PhotoSwipe.EventTypes.onDisplayImage, function(e){ 
    

    사람 : 나는 콘텐츠를 작성하는 jQuery를 사용하여이 문제를 해결 직접 같은 클래스를 호출했다

    swipe.addEventHandler(window.Code.PhotoSwipe.EventTypes.onDisplayImage, function(e){ 
    

    .

    +0

    예! 당신은 위대하다! 고맙습니다! 이것은 나를 많이 돕는다! :-) –

    관련 문제