使用select更改jquery.rss中的url提要

Using select for change url feed in jquery.rss

本文关键字:中的 url 提要 rss jquery select 更改 使用      更新时间:2023-09-26

我有一个问题,我想使用选择元素来改变我的列表url使用插件https://github.com/sdepold/jquery-rss.

这个链接,是我的代码选择,但不功能:http://jsfiddle.net/diegomachado/ktz5g892/

jQuery(function($) {
    $("#rss-feeds").rss("http://unsplash.com/rss", {
        limit: 10,
        layoutTemplate: '<ul>{entries}</ul>',
        entryTemplate: '<li>{teaserImageUrl}</li>',
        effect: 'slideFastSynced'
    })
})
<div>
<select class="feed-source">
    <option value="http://unsplash.com/rss">http://unsplash.com/rss</option>
    <option value="http://antbaena.tumblr.com/rss">http://antbaena.tumblr.com/rss</option>
    <option value="http://devon-jade.tumblr.com/rss">http://devon-jade.tumblr.com/rss</option>
</select>
<h1>jquery.rss example</h1>
<div id="rss-feeds"></div>

jQuery(function($) {
    $("#rss-feeds").rss("http://unsplash.com/rss", {
        limit: 10,
        layoutTemplate: '<ul>{entries}</ul>',
        entryTemplate: '<li>{teaserImageUrl}</li>',
        effect: 'slideFastSynced'
    })
    $(".feed-source").change(function(){
        $("#rss-feeds").html("");
        $("#rss-feeds").rss($(".feed-source").val(), {
            limit: 10,
            layoutTemplate: '<ul>{entries}</ul>',
            entryTemplate: '<li>{teaserImageUrl}</li>',
            effect: 'slideFastSynced'
        })
    });
})