waypoint Uncaught TypeError:无法读取未定义的属性'each'

时间:2017-09-07 22:07:15

标签: jquery ruby-on-rails vue.js jquery-waypoints

我正在使用航点,它发给我这条消息:

未捕获的TypeError:无法读取未定义的“每个”属性

这就是我用vue.js + rails获取代码的方式:

<template>
      <div id="playerContainer final">
         <iframe src="xxxxxxxxx" allowfullscreen></iframe> 
       </div>
</template>

<script>
  require('waypoints/lib/jquery.waypoints.min.js')
  export default {
    mounted(){
      var ele
      new Waypoint({
        element: ele = document.getElementById('final'),
        handler: function(direction) {
          if (direction == 'down') {
            $(ele).addClass('muestra')
          } else {
            $(ele).removeClass('muestra')
          }
          console.log(direction);
        }
      });
    }
  }
<script>

如果你能帮我解决这个问题,我真的很感激。

1 个答案:

答案 0 :(得分:1)

我发现div不能包含多个ID。如果在getElementById中指定整个id,则可以使其正常工作。

avatar_directory = 'uploads\profile\avatar\\';
$avatar_image = $request->{'profile-avatar'};
$avatar_new_name = 'profile'.$user->id.'_'.date('Y-m-d_H-i-s', time()).'_'.$avatar_image->getClientOriginalName();

Can a DOM element have an ID that contains a space?