[英]Loading jQuery plugin RhinoSlider content via AJAX
I'm using the jQuery plugin RhinoSlider
and have it working ok, however I want to load the content via AJAX to speed up the page load times. 我正在使用jQuery插件RhinoSlider
,它可以正常工作,但是我想通过AJAX加载内容以加快页面加载时间。 According to their site you need to change the call a little as per: http://rhinoslider.com/tricks/get-the-content-of-the-slider-via-ajax/ 根据他们的站点,您需要按照以下方式稍微更改通话: http : //rhinoslider.com/tricks/get-the-content-of-the-slider-via-ajax/
The default call is: 默认调用为:
$(document).ready(function(){
// store the jquery object
var $slider = $('#slider');
$.get('content-of-slider.php', function(data){
$slider.append(data).rhinoslider();
});
});
That works fine, however I still need to include my options, I tried the below but it didn't work.. 效果很好,但是我仍然需要包括我的选项,我尝试了以下操作,但没有用。
$(document).ready(function(){
// store the jquery object
var $slider = $('#slider');
$.get('content-of-slider.php', function(data){
$slider.append(data).rhinoslider(
showTime: 6000,
effectTime: 2500,
autoPlay: true,
showBullets: 'always',
showControls: 'never',
slidePrevDirection: 'toRight',
slideNextDirection: 'toLeft'
);
});
});
Seems I was missing the curly braces after the rhinoslider(
portion; I added them as below and it now works. 似乎我在rhinoslider(
部分)之后缺少了花括号;我如下添加它们,现在可以使用了。
$(document).ready(function() {
// store the jquery object
var $slider = $('#slider');
$.get('content-of-slider.php', function(data){
$slider.append(data).rhinoslider({
showTime: 6000,
effectTime: 2500,
autoPlay: false,
showBullets: 'always',
showControls: 'never',
slidePrevDirection: 'toRight',
slideNextDirection: 'toLeft'
});
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.