【问题标题】:Photo Gallery Filter Looks Corrupt on 1st Load But looks fine when I Refresh?照片库过滤器在第一次加载时看起来损坏但在我刷新时看起来很好?
【发布时间】:2020-11-14 21:13:06
【问题描述】:

这很奇怪。当我第一次访问我的网站时,我的作品集画廊看起来已损坏,但当我刷新时一切看起来都很好。 如果您可以在计算机上查看我的网站并告诉我您是否看到相同的内容,我将不胜感激。 (我的网站还不适合移动设备)

另外请告诉我如何解决这个问题。我正在使用 Jquery & Isotope 来实现此功能。

http://ruben123.com/

【问题讨论】:

    标签: html jquery css jquery-isotope portfolio


    【解决方案1】:

    好吧,我在这里或其他任何地方都没有得到答案,在花了 2 天时间试图弄清楚但没有运气后,我付了一个印度人 40 美元来找出答案。

    基本上我需要更新 javascript 代码并在下面添加此代码。

        $(window).on('load', function(){
        //Original Code Goes inside here
    });
    

    之前的代码

         $('.grid').isotope({
            itemSelector: '.grid-item',
          });
          
          // filter items on button click
          $('.filter-button-group').on( 'click', 'li', function() {
            var filterValue = $(this).attr('data-filter');
            $('.grid').isotope({ filter: filterValue });
            $('.filter-button-group li').removeClass('active');
            $(this).addClass('active');
          });
    

    之后的代码

        $(window).on('load', function(){
          $('.grid').isotope({
            itemSelector: '.grid-item',
          });
          
          // filter items on button click
          $('.filter-button-group').on( 'click', 'li', function() {
            var filterValue = $(this).attr('data-filter');
            $('.grid').isotope({ filter: filterValue });
            $('.filter-button-group li').removeClass('active');
            $(this).addClass('active');
          });
        });
    

    所以我认为发生的事情是因为我有很多图像,所以同位素不能正常工作。

    进行此更改后,图像已正确上传到本地主机和在线。我发布这个答案以防其他人遇到同样的问题。

    【讨论】:

      猜你喜欢
      • 2014-01-08
      • 2015-05-14
      • 2016-05-24
      • 1970-01-01
      • 1970-01-01
      • 2021-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多