Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery循环插件和动态内容_Jquery_Jquery Cycle_Jquery Cycle2 - Fatal编程技术网

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();
});
});
});