Fancybox problem on iPhone

前端 未结 4 1905
北荒
北荒 2021-01-01 21:07

Fancy box seems to have problems working on iPhone and iPad.

Go here http://fancybox.net/blog and click \"5. Display login form Try now\" on the page in an iPhone or

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-01 21:33

    Quite an old problem, but had this plugin running on an old site. I noticed that Fancybox adds the class "fancybox-lock" to the HTML tag, using some simple JS i've added this to the BODY and it appears to be working okay now.

    Hope this helps someone!

    JQuery

    $(function(){
         var fancyboxVisible = false;
            $(document).on('click', '.fancybox', function() {
               if(fancyboxVisible) {
                   $('html, body').removeClass('fancybox-lock');
                   fancyboxVisible = false;
               } else {
                   $('html, body').addClass('fancybox-lock');
                   fancyboxVisible = true;
               }
            });
    });
    

提交回复
热议问题