Velocity.js - 触发动画

Velocity.js - triggering animations

我目前正在尝试摆脱一堆 CSS 动画并替换为 Velocity.js(在构建新动画的过程中)。

目前我有一个网格项目:

<div class="video-thumbnail">
  <img src="http://placehold.it/1280x720" class="imgspacer" alt="{$info['title']}" />
  <div class="overlay">
    <a href="http://bbc.co.uk" class="thumbnail-link">
      <div class="title">
        <div class="title-display">
          <h5 class="SlideIn">Title One</h5>
          <h6 class="SlideIn">Title Two</h6>
        </div>
      </div>
    </a>
  </div>
</div>

这是通过 CSS 控制的,以淡入 .overlay 元素。然后我想做的是 h5 & h6 类 向上滑动。

我写了下面的代码:

$('.overlay').hover(function(){ 
    $(this).find('.SlideIn').velocity("transition.slideUpIn", {stagger: 100, duration: 500});
});

但似乎什么也没有发生。我是 Javascript 的新手,所以我假设我在某处犯了一个愚蠢的错误,但无法弄清楚它是什么。

我在下面包含了一个完整的片段,您也可以找到它 here

$('.overlay').hover(function(){ 
 $(this).find('.SlideIn').velocity("transition.slideUpIn", {stagger: 100, duration: 500});
});
#thumbnail-array {
 width: 100%;
}

.gutter-sizer {
 width: 0.03%;
}

.video-thumbnail {
    position: relative;
    background-color: #777;
    overflow: hidden;
    line-height: 0px;
    margin: 0px;
}

.video {
    position: absolute;
    margin-top: none;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: none;
}

.overlay {
    position: absolute;
    left: 0px;
    top: 0px;
    bottom: 0px;
    right: 0px;
    width: 100%;
    height: 100%;
    z-index: 50;
}


.thumbnail-link {
    display: table;
    width: 100%;
    height: 100%; /*important, forces to 100% height of parent*/
    opacity:0;
    -webkit-transition: opacity .5s ease;
    -moz-transition: opacity .25s ease;
    background: rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
    text-decoration: none; 
}


.title {
    display: table-cell;
    vertical-align: middle;
    text-align: center;
    text-decoration: none;
    color: #FFFFFF;
    font-family: helvetica;
    width: 100%;
    line-height: 0px;
}

.title-display {
 display: block;
 width: 100%;
}

.video-thumbnail:hover .thumbnail-link {
    text-decoration: none;
    opacity:1;
}

.imgspacer {
 width: 100%;
    max-width:100%;
}

.picturehelper {
 display: inline-block;
}

.video-thumbnail:hover .video {
    display: inline;
}

h5 {
 display: inline-block;
 width: 100%;
    font-size: 2em;
    margin: 0px;
    padding: 0px;
    line-height: normal;
}

h6 {
 display: inline-block;
 width: 100%;
    font-size: 0.75em;
    letter-spacing: 0.3em;
    padding: 0px;
    margin: 0px;
    font-weight: 100;
    line-height: normal;
}
<script src="https://raw.githubusercontent.com/julianshapiro/velocity/master/velocity.min.js"></script>
<script src="https://raw.githubusercontent.com/julianshapiro/velocity/master/velocity.ui.js"></script>
<script src="https://raw.githubusercontent.com/julianshapiro/velocity/master/velocity.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="video-thumbnail">
  <img src="http://placehold.it/1280x720" class="imgspacer" alt="{$info['title']}" />
  <div class="overlay">
    <a href="http://bbc.co.uk" class="thumbnail-link">
      <div class="title">
        <div class="title-display">
          <h5 class="SlideIn">Title One</h5>
          <h6 class="SlideIn">Title Two</h6>
        </div>
      </div>
    </a>
  </div>
</div>

如@AldoRomo88 和@jmcgriz 所述,页面上脚本的加载顺序存在问题。

我通过简单地首先加载查询(并将脚本托管在我自己的服务器上!)解决了这个问题