2017-05-19 105 views
0

我试图使ekko灯箱内的旋转图像,但到目前为止还没有成功。这里是jsfiddle为你修补。提前致谢。Ekko灯箱旋转图像

$(document).on('click', '[data-toggle="lightbox"]', function(event) { 
    event.preventDefault(); 
    $(this).ekkoLightbox({ 
     onShow: function() { 
     $('.ekko-lightbox-container').append('<div class="rotate-button"><a href="#" class="pull-right rotate" style="font-size: 18px;padding: 3px 0;"><i class="fa fa-repeat" aria-hidden="true"></i> Rotate</a></div>') 

     var degrees = 0; 
     $('.rotate').bind('click', function(event) { 
       event.preventDefault(); 
       var $lightboxphoto = $('.ekko-lightbox').children().find('img'); 
       degrees += 90; 
       $lightboxphoto.css('-ms-transform', 'rotate(' + degrees + 'deg)'); 
       $lightboxphoto.css('-webkit-transform', 'rotate(' + degrees + 'deg)');  
     }); 
     }, 
    }); 
}); 

回答