mixItUp jQuery插件不起作用

时间:2016-10-17 14:05:59

标签: javascript jquery css html5

我已按照mixitup文档中的所有说明操作 仍然插件无法正常工作。

插件中唯一可行的功能是当我刷新页面时,图像会移动,但是当我点击视频或咖啡或手机时 什么都没发生!



//script
$('#Container').mixItUp();

.portfolio {
  height: 400px;
}
.portfolio h2 {
  margin: 0;
  padding-top: 50px;
  padding-bottom: 40px;
  font-weight: normal;
}
.portfolio ul li {
  display: inline-block;
  color: #555;
  border: 2px solid #DDD;
  padding: 10px 20px 10px 20px;
}
.portfolio ul {
  padding: 0;
  margin: 0;
}
.portfolio ul li.active {
  background-color: #1abc9c;
  border: 2px solid #1abc9c;
  color: white;
}
.gallery {
  margin: 40px 0 0 0;
}
.gallery .row div {
  width: 30.3333%;
  float: left;
  position: relative;
  margin: 5px;
}
.gallery .row img {
  width: 100%;
  height: 100%;
}
.gallery .row .g-overlay {
  position: absolute;
  top: -6px;
  left: -5px;
  width: 100%;
  height: 100%;
  /*background-color: rgba(0,0,0,.7);*/
  background-color: #1abc6c;
  opacity: 0.9;
  display: none;
}
.gallery .row .g-overlay h3 {
  color: #FFF;
  text-align: center;
  line-height: 180px;
}
.gallery .row .g-overlay span.heart {
  position: absolute;
  bottom: 10px;
  color: white;
  right: 10px;
}
.gallery .row div:hover .g-overlay {
  display: block;
}
/* Mixit up plugin*/

#Container .mix {
  display: none;
}

<div class="portfolio">
  <div class="container">
    <h2>Projects</h2>
    <ul>
      <li class="active filter" data-filter="all">All</li>
      <li class="filter" data-filter=".mobile">Mobile</li>
      <li class="filter" data-filter=".coffee">Coffee</li>
      <li class="filter" data-filter=".video">video</li>
    </ul>
    <div id="Container" class="gallery">
      <div class="row">
        <div class="mix mobile">
          <img src="images/gallery/1.jpg">
          <div class="g-overlay">
            <h3>Read More</h3>
            <span class="heart"><i class="fa fa-heart" aria-hidden="true"></i> 14</span>
          </div>
        </div>
        <div class="mix coffee">
          <img src="images/gallery/2.jpg">
          <div class="g-overlay">
            <h3>Read More</h3>
            <span class="heart"><i class="fa fa-heart" aria-hidden="true"></i> 14</span>
          </div>
        </div>
        <div class="mix video">
          <img src="images/gallery/3.jpg">
          <div class="g-overlay">
            <h3>Read More</h3>
            <span class="heart"><i class="fa fa-heart" aria-hidden="true"></i> 14</span>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="mix video">
          <img src="images/gallery/4.jpg">
          <div class="g-overlay">
            <h3>Read More</h3>
            <span class="heart"><i class="fa fa-heart" aria-hidden="true"></i> 14</span>
          </div>
        </div>
        <div class="mix mobile">
          <img src="images/gallery/5.jpg">
          <div class="g-overlay">
            <h3>Read More</h3>
            <span class="heart"><i class="fa fa-heart" aria-hidden="true"></i> 14</span>
          </div>
        </div>
        <div class="mix coffee">
          <img src="images/gallery/6.jpg">
          <div class="g-overlay">
            <h3>Read More</h3>
            <span class="heart"><i class="fa fa-heart" aria-hidden="true"></i> 14</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

enter image description here

2 个答案:

答案 0 :(得分:0)

如何将JS放入dom准备好的函数中?

if let arr = json as? [Dictionary<String, AnyObject>] {
   for item in arr {
      if let localityName = item["name"] as? String,
         let localityId = item["_id"] as? String {
         print(localityName, localityId)
      }
   }
}

答案 1 :(得分:0)

它有效.. 这段代码   $(&#39;#集装箱&#39;)mixItUp();

必须位于js代码的第一个