砌体高度问题

时间:2019-06-25 07:21:21

标签: jquery-masonry

我有一个带过滤器等的砌体“组合”,但是元素高度有问题。

我尝试删除网站中的所有javascript,停用wordpress插件等,但似乎无济于事。

我认为使用引导程序有问题吗?那是问题吗? 我需要做的是修复当您使用上面的过滤器时看起来有效的元素的高度,例如刷新或类似的操作然后再起作用,但是如果您多次重新加载页面,您将看到元素高度的问题。

我在做什么错了?

在小提琴中您不会看到错误。

this is the real site working where you can see the problem

代码:

<script>
  $('.filters ul li').click(function() {
    // $('.filters ul li').removeClass('active');
    // $(this).addClass('active');
    $('.filters ul li').removeClass('after-click');
    $(this).addClass('after-click');
    var data = $(this).attr('data-filter');
    $grid.isotope({
      filter: data,
    });
  });

var $grid = $('.grid').isotope({
  itemSelector: '.all',
  percentPosition: true,
  masonry: {},
}); 
</script>
.block {
  width: 20%;
  height: 100%;
  float: left;
}


#block3 {
  background: #fff;
/*   overflow-y: scroll; */
  padding-bottom: 2%;
}


/* portfolio page styling */

.section {
  padding: 30px 0;
  color: #333;
}
.section .top-side {
  text-align: center;
}
.section .top-side .title {
  font-weight: 500;
  font-size: 30px;
  color: #888;
  display: inline-block;
}
.section .top-side .title:after {
  content: '';
  display: block;
  width: 50%;
  border-bottom: 1px solid #494949;
  margin: 2px auto;
}
/* .section .top-side h2 {
  font-weight: 700;
} */
.section.portfolio .filters {
  text-align: center;
  margin-top: 10px;
}
.section.portfolio .filters ul {
  padding: 0;
}
.section.portfolio .filters ul li {
  list-style: none;
  display: inline-block;
  cursor: pointer;
  position: relative;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 4px;
  -webkit-transition: all 0.3s;
  transition: all 0.3s;
  margin: 5px;
  letter-spacing: 1px;
}
.section.portfolio .filters ul li:after {
  content: '';
  display: block;
  width: calc(0% - 60px);
  position: absolute;
  height: 2px;
  background: #333;
  transition: width 350ms ease-out;
}
.section.portfolio .filters ul li:hover:after {
  width: calc(100% - 60px);
  transition: width 350ms ease-out;
}
.section.portfolio .filters ul li.active:after {
  width: calc(100% - 60px);
}
.section.portfolio .filters-content {
  margin-top: 50px;
}
.section.portfolio .filters-content .show {
  opacity: 1;
  visibility: visible;
  transition: all 350ms;
}
.section.portfolio .filters-content .hide {
  opacity: 0;
  visibility: hidden;
  transition: all 350ms;
}
.section.portfolio .filters-content .item {
  text-align: center;
  /* cursor: pointer; */
  margin-bottom: 30px;
  /* border for the image and content */
  /* border: 2px solid blue; */
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.section.portfolio .filters-content .item .p-inner {
  padding: 2px 30px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.section.portfolio .filters-content .item .p-inner h5 {
  font-size: 18px;
  font-family: 'Raleway', sans-serif;
  color: #888;
  margin: 5px 0 0 0;
  font-weight: bold;
  letter-spacing: 1px;
}
.section.portfolio .filters-content .item .p-inner .cat {
  font-size: 16px;
  margin: 0;
  padding: 10px;
  text-align: center;
  font-weight: 500;
  color: #888;
  letter-spacing: 0.5px;
}
.section.portfolio .filters-content .item img {
  width: 100%;
  /* margin-bottom: 2px; */
}
.after-click {
  color: #87ceeb;
  font-weight: bold;
}
.project-view a {
  text-decoration: none;
  font-size: 16px;
  letter-spacing: 1px;
  color: #808080;
}

.after-click {
  color: #87ceeb;
  font-weight: bold;
}

.project-view {
  display: block;
  width: 60%;
  margin: 5px auto;
  padding: 10px;
  border: 1px solid #888;
  border-radius: 6px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.project-view a:hover {
  color: #c0c0c0;
}
/* end of the portfolio page styling   */
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>

<!-- projects section start -->
<section class="portfolio section">
  <div class="container-fluid">
    <div class="top-side">
      <h2 class="title">My Projects</h2>
      <!-- <h2>PORTFOLIO</h2> -->
    </div>

    <div class="filters">
      <ul>
        <li class="active" data-filter="*"> All</li>
        <li data-filter=".frontend">FrontEnd</li>
        <li data-filter=".python">Python</li>
        <li data-filter=".dv">Data Visualization</li>
        <li data-filter=".vue">Vue.js</li>
      </ul>
    </div>

    <div class="filters-content">
      <div class="row grid">
        <!-- front-end projects start -->
        <div class="col-sm-4 all frontend">
          <div class="item">
            <img src="https://res.cloudinary.com/dlof5usn7/image/upload/c_scale,h_150,w_350/v1508550296/tribute-rafa_bjq4wi.png" alt="Work 1">
            <div class="p-inner">
              <h5>Tribute Page</h5>
              <div class="cat"></div>
              <div class="project-view">
                <a href="https://codepen.io/ravikishorethella/full/bWJNJP/" target="_blank">View Project</a>
              </div>
            </div>
          </div>
        </div>
        <div class="col-sm-4 all dv">
          <div class="item">
            <img src="https://res.cloudinary.com/dlof5usn7/image/upload/c_scale,h_150,w_350/v1508559810/dv_life_exp_owbzxs.png" alt="Work 1">
            <div class="p-inner">
              <h5>Life Expectancy in USA</h5>
              <div class="cat"></div>
              <div class="project-view">
                <a href="https://ravikishorethella.github.io/life_expectancy_in_US_visualization/" target="_blank">View Project</a>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>

  </div>
</section>
<!-- end of the project section -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js'></script>

0 个答案:

没有答案