Интеграция Fancybox в blogger не работает - PullRequest
0 голосов
/ 27 мая 2020

извините, я мало знаю программирование / javascript извините за любую ошибку

Я интегрировал fancybox в blogger, используя этот метод. https://www.stramaxon.com/2017/05/custom-lightbox-blogger-fancybox3.html

при использовании fancybox версии 3.0.47 js и css работает нормально

https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.js https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.css

, но когда я перехожу на версию 3.5.7

https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css

он не работает.

Вот код для отображения изображений в блоге в fancybox

//<![CDATA[
 $(document).ready(function(){
   /**************************
   This part makes sure we select only the images and photos that is supposed to appear in a lightbox
   **************************/
   $(".post-body a img").each(function(){
     var isImage = /\.(?:jpg|jpeg|gif|png)$/i.test( $(this).parent("a").attr("href") );

     if ( isImage ) {
       $(this).parent("a").attr('data-src', $(this).parent("a").attr("href"));
       $(this).parent("a").attr('data-fancybox', 'postLightBox' );
     }

     else {
       // .. do nothing
     }
   });


   /**************************
   This part initializes FancyBox on the qualifying images
   **************************/
   var options = {
       infobar  : true,
       buttons  : true,
       speed    : 300,  // Animation duration in ms
      margin : [40, 20] // Space around image, ignored if zoomed-in or viewport smaller than 800px
   };

   $("[data-fancybox]").fancybox( options );
 });
//]]>
</script> ```

what to modify in code to work on latest version of fancybox 3.5.7?
...