[英]How to implement jQuery Plugin Smoothstate?
I seem to have some problem on my website aviralgupta.xyz when i click on the skills link.当我点击技能链接时,我的网站 aviralgupta.xyz 上似乎有一些问题。 I don't understand why it isn't working?我不明白为什么它不起作用? Pls help I get this error in console for js file functions.js : Uncaught TypeError: content.toggleAnimationClass is not a function请帮助我在 js 文件functions.js 的控制台中得到这个错误:Uncaught TypeError: content.toggleAnimationClass is not a function
I've seen this question come up a few times.我已经看到这个问题出现了几次。 The functions.js that they show on their site uses toggleAnimation() and it doesn't seem to work.他们在网站上显示的 functions.js 使用 toggleAnimation() 并且它似乎不起作用。 Maybe with the newer version of jQuery.也许使用较新版本的 jQuery。
I used a different functions setup:我使用了不同的功能设置:
$(function(){
'use strict';
var $page = $('#main'),
options = {
debug: true,
prefetch: true,
cacheLength: 2,
forms: 'form',
onStart: {
duration: 250, // Duration of our animation
render: function ($container) {
// Add your CSS animation reversing class
$container.addClass('is-exiting');
// Restart your animation
smoothState.restartCSSAnimations();
}
},
onReady: {
duration: 0,
render: function ($container, $newContent) {
// Remove your CSS animation reversing class
$container.removeClass('is-exiting');
// Inject the new content
$container.html($newContent);
}
}
},
smoothState = $page.smoothState(options).data('smoothState');
});
There is a very good demo provided on the website and a good point to start.网站上提供了一个非常好的演示,并且是一个很好的起点。 It says;它说;
All we need to get started is:我们需要开始的是:
1) Include a copy of jQuery and jQuery.smoothState.js on your page 1) 在您的页面上包含 jQuery 和 jQuery.smoothState.js 的副本
2) Create a new js file and run $('#main').smoothState() 2)新建一个js文件,运行$('#main').smoothState()
3) Add container with an id of "#main" and include some links inside of it 3) 添加 id 为“#main”的容器并在其中包含一些链接
Link: http://miguel-perez.github.io/smoothState.js/getting-started.html链接: http : //miguel-perez.github.io/smoothState.js/getting-started.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.