[英]Can't get scrollmagic to swipe up 'natural' in wordpress theme
Running into a problem with the scrollmagic 'section wipes (natural)' activation. 滚动魔术师的“部分擦拭(自然)”激活遇到问题。 What I have in my wordpress theme:
我在wordpress主题中有什么:
functions.php 的functions.php
wp_enqueue_script( 'tweenmax' );
wp_enqueue_script( 'scrollMagic' );
wp_enqueue_script( 'scrollMagicPlugin' );
wp_enqueue_script( 'scrollMagicDebug' );
wp_enqueue_script( 'sceneControls' );
the scene controller is sceneControls.js and includes 场景控制器是sceneControls.js,其中包括
sceneControls.js sceneControls.js
$(function () { // wait for document ready
// init
var controller = new ScrollMagic.Controller({
globalSceneOptions: {
triggerHook: 'onLeave'
}
});
// get all slides
var slides = document.querySelectorAll(".section");
// create scene for every slide
for (var i=0; i<slides.length; i++) {
new ScrollMagic.Scene({
triggerElement: slides[i]
})
.setPin(slides[i])
.addIndicators() // add indicators (requires plugin)
.addTo(controller);
}
});
I am receiving console errors however, I may be including sceneControls.js in a bad manner. 我收到控制台错误,但是可能以不好的方式包含了sceneControls.js 。
Console Readout 控制台读数
Uncaught TypeError: $ is not a function
Any thoughts, have tried several variations: 任何想法,都尝试了几种变体:
wp_enqueue_script( 'sceneControls' );
Help is greatly appreciated! 非常感谢您的帮助! Thank you in advance!
先感谢您!
This was revised. 对此进行了修订。 Rnevius after changing the function to a noConflict.
将函数更改为noConflict后的Rnevius。 The console no longer shows an error but the behaviour is not there.
控制台不再显示错误,但是行为不存在。
Per last comment 最后的评论
var $ =jQuery.noConflict();
just before calling 在打电话之前
$(document).ready(function () {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.