[英]Can't render Flickerplate Slideshow on Meteor Page
我似乎无法在流星代码中使用Flickerplate.js正确渲染幻灯片。 我正在从非流星代码改编它。
我的幻灯片div模板具有以下代码:
<template name="Slideshow">
<div class="flicker-slideshow">
<ul>
<li data-background="images/cover.jpg">
<div class="flick-title">Welcome</div>
<div class="flick-sub-text">To our page</div>
</li>
<li data-background="images/profile.jpg">
<div class="flick-title">Who are we?</div>
<div class="flick-sub-text">We are us</div>
</li>
<li data-background="images/friends.jpg">
<div class="flick-title">Friends</div>
<div class="flick-sub-text">Our friends</div>
</li>
</ul>
</div>
和我的JavaScript代码如下:
Template.Slideshow.rendered = function() {
$('.flicker-slideshow').flickerplate({
arrows: true,
arrows_constraint: false,
auto_flick: true,
auto_flick_delay: 10,
block_text: true,
dot_alignment: 'center',
dot_navigation: true,
flick_animation: 'transition-slide',
flick_position: 1,
theme: 'light'
});
}
我在浏览器的控制台上收到一条错误消息:
Exception from Tracker afterFlush function: undefined is not a function
TypeError: undefined is not a function
at Template.Slideshow.rendered (http://localhost:3000/client/views/slideshow.js?330e430ab7dab250766bdd68b706ee963571dc87:2:29)
at null.<anonymous> (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:2924:21)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1720:14
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:2029:12)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1719:15
at Tracker.flush (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:438:11)
正如stubailo在评论中建议的那样,我所需要做的就是将其添加到模板中。 所以:
this.$('.flicker-slideshow').flickerplate();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.