[英]Loading images via AJAX into jQuery Supersized plugin
I'm trying to dynamically load images via AJAX into the jQuery "Supersized" image slider: http://buildinternet.com/project/supersized/ 我正在尝试通过AJAX动态加载图像到jQuery“Supersized”图像滑块: http : //buildinternet.com/project/supersized/
The AJAX call replaces the images fine, but the play button then becomes unresponsive, and subsequent calls disturb the slide interval timings (slides change faster). AJAX调用可以很好地替换图像,但播放按钮则无响应,后续调用会影响幻灯片间隔时间(幻灯片更改速度更快)。
I've tried all the answers (without luck) provided in a similar question here (same code). 我想在一个类似的问题所提供的所有答案(没有运气) 这里 (相同的代码)。 They suggested it could be a binding issue.
他们认为这可能是一个具有约束力的问题
So in the html: 所以在html中:
<a href="javascript:brown();">Doeet</a>
Ajax call: Ajax调用:
function red(){
$.ajax({
url: 'ajax.php?action=brown',
success: function(data){
$('#script').html(data);
}
})
}
Ajax.php: Ajax.php:
<?php switch($_GET["action"]){
case "brown":
echo "<script type='text/javascript'>
jQuery(function($){
$('#supersized').html('');
$.supersized({
slides : [{image : 'image1.jpg'},
{image : 'image2.jpg'}]
});
});</script>";
break; }
?>
do not try to pass the entire javascript code to transmit. 不要试图传递整个javascript代码进行传输。 only transmit the params u need:
只发送您需要的参数:
function red(){
$.ajax({
url: 'ajax.php?action=brown',
success: function(data){
if (data != "") {
$('#supersized').html('');
$.supersized({
slides : [{image : data}],
....
});
}
}
})
}
php: PHP:
<?php
switch($_GET["action"]){
case "brown":
echo "imagename.jpg";
break;
}
?>
and may use 并可能会使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.