【问题标题】:Isotope elements not displayed inline同位素元素未内联显示
【发布时间】:2017-05-15 10:31:57
【问题描述】:

我在我的 Wordpress 网站中使用了同位素,但遇到了无法内联显示我的元素的问题。

我已将每个网格元素设置为 25vw 的宽度和 25vw 的高度。

在大屏幕尺寸的初始页面加载时,我可以看到我的网格项目 4。

当我减小浏览器宽度时,元素会缩小,但是我只能看到水平显示的 3 个项目。

请帮助我在所有屏幕尺寸下显示 4 个项目。

    // init Isotope
    var $grid = $('.grid').isotope({
        itemSelector: '.element-item',
    });

   .single-artist-container {
    display: inline-block;
    height: 25vw;
    width: 25vw;
    background-size: cover;
    vertical-align: middle;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    color: #fff;
    left:auto;
    top: auto;
  }
    .artist-feed .overlay {
     background: rgba(0, 0, 0, 0.7);
     height: 100%;
     width: 100%;
   }
   .artist-info {
   margin-left: auto;
   margin-right: auto;
   text-align: center;
   padding-top: 40%;
   color: #fff;
   }

<div class="artist-feed">
        <div class="grid">
                    <?php
                        $artistloop = new WP_Query( array( 'post_type' => 'artist', 'posts_per_page' => -1, 'orderby'=>'title','order'=>'ASC') );
                     if ( $artistloop->have_posts() ) :
                            while ( $artistloop->have_posts() ) : $artistloop->the_post();
                            $lineup_image = fx_get_meta('lineup_image');
                     ?>
                        <div class="single-artist-container element-item" data-days="<?php echo                     $days; ?>" style="background-image: url(<?php echo $feature_image; ?>);">
                        <a href="<?php the_permalink(); ?>">
                            <div class="overlay">
                                <div class="artist-info">
                                <h2><?php the_title(); ?></h2>
                                <h4><?php echo $country ;?></h4>
                                </div>
                        </div>
                        </a>
                </div>
                    <?php endwhile;
                endif;
            wp_reset_postdata();
                ?>
        </div>

【问题讨论】:

    标签: jquery wordpress jquery-isotope


    【解决方案1】:

    尝试设置

    .element-item--width2 { width: 25%; }
    

    您可以参考同位素文档here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-08
      • 1970-01-01
      • 2018-03-27
      • 1970-01-01
      • 1970-01-01
      • 2014-03-04
      • 2012-05-15
      • 1970-01-01
      相关资源
      最近更新 更多