jQuery循环插件和动态内容
我一直在努力解决这个问题,我正在使用插件,并尝试使用下面的脚本动态创建内容 内容写入jQuery循环插件和动态内容,jquery,jquery-cycle,jquery-cycle2,Jquery,Jquery Cycle,Jquery Cycle2,我一直在努力解决这个问题,我正在使用插件,并尝试使用下面的脚本动态创建内容 内容写入.cycle幻灯片放映div,但.cycle()似乎不会运行。还有什么我可以试试的吗 我从php页面获取内容,在幻灯片中显示在幻灯片中,然后查询openweathermap.com api以获得结果。所有这些返回值都被包装在.slidediv中 html <div class="module-content"> <div class="cycle-slideshow weather bl
.cycle幻灯片放映
div,但.cycle()
似乎不会运行。还有什么我可以试试的吗
我从php页面获取内容,在幻灯片中显示在幻灯片中,然后查询openweathermap.com api以获得结果。所有这些返回值都被包装在.slide
div中
html
<div class="module-content">
<div class="cycle-slideshow weather blue-box">
</div>
<div class="cycle-pager weather-pager blue-box"></div>
</div>
jQuery
var $ = jQuery;
$(document).ready(function() {
$.getJSON( "http://api.openweathermap.org/data/2.5/weather?q=Aberdeen,uk&units=metric", function( data ) {
var weather = data.weather[0].main;
var temp = Math.round(data.main.temp);
$(".weather").append("<div class=\"slide\"><div class=\"curr-weather\"><h3>"+weather+"</h3><h2>"+temp+"°C</h2></div></div>");
});
$(function(){
var contentURI= "http://www.domain.co.uk/page.php";
$(".weather").append("<div class=\"slide\"><div id=\"landings\"></div></div>");
var jqxhr = $.get( "wp-content/plugins/weather-plugin/grab.php?url="+ contentURI, function(data) {
var lands = $(data).find("#sidebar-bgbtm .data");
lands = lands.splice(0,1);
console.log(lands);
$("#landings").append(lands);
})
.done(function(data){
$(".weather").cycle();
});
});
});
var$=jQuery;
$(文档).ready(函数(){
$.getJSON(“http://api.openweathermap.org/data/2.5/weather?q=Aberdeen,英国&单位=公制”,功能(数据){
var weather=data.weather[0].main;
var temp=数学圆(data.main.temp);
$(“.weather”)。附加(“+weather+”+temp+“°C”);
});
$(函数(){
var contentURI=”http://www.domain.co.uk/page.php";
$(“.weather”)。附加(“”);
var jqxhr=$.get(“wp-content/plugins/weather-plugin/grab.php?url=“+contentURI,函数(数据)){
var lands=$(数据).find(#边栏bgbtm.data”);
焊盘=焊盘拼接(0,1);
控制台.日志(地);
$(“#着陆”)。追加(着陆);
})
.完成(功能(数据){
$(“.weather”).cycle();
});
});
});