2013-03-19 63 views
3

問題:從列表中選擇一個訂閱源並按下一個按鈕返回到主頁div後,jQuery將重新加載整個頁面,並且只顯示新選定網頁的標題(沒有任何訂閱源)。 默認情況下,在另一個div頁面上選擇此特定選項(選擇一個Feed)之前,標題(「Reuters Oddly Enough News」)和Feed正在顯示,沒有任何問題。zRSSFeed - 從帶菜單動畫的菜單中選擇RSS提要+ jQuery Mobile(PhoneGap)?

<div data-role="page">代碼如下</div>

<h4>Select a feed from the list below</h4> 
<select id="menu"> 
       <option value="http://feeds.reuters.com/reuters/oddlyEnoughNews">Reuters Oddly Enough News</option> 
       <option value="http://feeds.bbc.co.uk/iplayer/highlights/tv/list">BBC iPlayer TV Listing</option> 
       <option value="http://rss.cnn.com/rss/edition.rss">CNN News</option> 
</select> 

選擇RSS從股票動畫菜單提要:

<script type="text/javascript"> 
$(document).ready(function() { 

       setRSSFeed('#menu'); 

       $('#menu').change(function() { 
           setRSSFeed(this) 
       }); 

       function setRSSFeed(obj) { 
           var feedurl = $('option:selected', obj).val(); 

           if (feedurl) { 
               $('#test').rssfeed(feedurl,{}, function(e) { 
                   $(e).find('div.rssBody').vTicker(); 
               }); 
           } 
       } 
}); 
</script> 

回答

2

我已經測試過了,它的工作原理沒有問題。除非我沒有得到你真正需要的東西。

zRSSFeed W /北京時間動畫+ jQuery Mobile的

$('#menu').on('change', function() { 
var selected = $(this).val(); 
    $('#test').rssfeed(selected,{}, function(e) { 
    $(e).find('div.rssBody').vTicker(); 
}); 
}); 

HTML

<div data-role="page" id="page"> 
<div data-role="content"> 
    <h4>Select a feed from the list below</h4> 

    <select id="menu"> 
     <option value="#">Choose</option> 
     <option value="http://feeds.reuters.com/reuters/oddlyEnoughNews">Reuters Oddly Enough News</option> 
     <option value="http://feeds.bbc.co.uk/iplayer/highlights/tv/list">BBC iPlayer TV Listing</option> 
     <option value="http://rss.cnn.com/rss/edition.rss">CNN News</option> 
    </select> 
    </div> 
<div id="test"></div> 
</div>