[ajax] update! 用AJAX取得XML在寫入網頁
這是成果發表會~
用jQuery寫的 特別PO上來給版友們吐嘈XDD
不過找不到空間放怎麼辦
最後只好丟HINET ADSL送的空間了
http://s25g5d4.sg1010.myweb.hinet.net/index.html
script部分
$(document).ready(function () {
$.ajax({
url: 'xml/3.xml?='+Math.floor(Math.random()*1000),
dataType: 'xml',
success: function (data) {
$(data).find("album").each(function(i){
var img=$(this).find("image"),content='';
content+='<div class="album"><table><tr><td><img
src="'+img.text()+'"'+(img.attr('width')?'
width="'+img.attr('width')+'"':'')+(img.attr('height')?'
height="'+img.attr('height')+'"':'')+' /></td><td
class="intro"><h2>'+$(this).find("name").text()+'</h2><h3>'+$(this).find("artist").text()+'</h3><ol
class="track">';
$(this).find("track").each(function (index) {
content+='<li>'+$(this).text()+'</li>';
});
_data=$('#data').append(content+"</ol><span
class='desc'>"+$(this).find("desc").text()+"</span></td></tr></table></div>");
});
divAlbum=$('div.album').hover(function(){
$(this).animate({"opacity":1},300);
},function(){
$(this).animate({"opacity":0.8},300);
});
_data.animate({"opacity":1},800);
olTrack=$('ol.track');
divAlbum=$('div.album');
func=function(){
divHighlight=$(this).removeClass('album').addClass('highlight');
$('div.album').hide(500);
divHighlight.find('span.desc').hide(500,function(){
$(this).appendTo(_data).show(500).attr('id','spanDesc');
});
olTrack.show(500);
$('div.highlight img').one('click',function(){
$('div.album').show(500,function(){
$('#spanDesc').hide(0,function(){
$(this).appendTo('div.highlight
td.intro').removeAttr('id').show(500);
divHighlight.removeClass('highlight').addClass('album');
divAlbum.one('click',func);
});
olTrack.hide(500);
});
});
}
divAlbum.one('click',func);
}
});
});
--
→
07/30 11:27,
07/30 11:27
推
07/30 11:30,
07/30 11:30
→
07/30 11:34,
07/30 11:34
→
07/30 11:47,
07/30 11:47
推
07/30 11:50,
07/30 11:50
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.127.208.70
→
08/05 23:53, , 1F
08/05 23:53, 1F
→
08/06 00:00, , 2F
08/06 00:00, 2F
→
08/06 00:00, , 3F
08/06 00:00, 3F
→
08/06 00:01, , 4F
08/06 00:01, 4F
※ 編輯: s25g5d4 來自: 59.127.208.70 (08/06 21:47)
※ s25g5d4:轉錄至看板 Web_Design 08/06 23:18
推
08/06 23:35, , 5F
08/06 23:35, 5F
→
08/07 00:20, , 6F
08/07 00:20, 6F
→
08/07 00:21, , 7F
08/07 00:21, 7F
推
08/09 02:20, , 8F
08/09 02:20, 8F
推
09/07 00:46, , 9F
09/07 00:46, 9F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章