2011-04-15 91 views
7

我創建在Flash這個圖形「半餡餅」:http://www.elperiodico.com/es/elecciones-28n/
現在我把它移植到JavaScript的:http://especiales.elperiodico.com/LABS/ELEC2011B/html/emi-basic2.htm動畫半餅圖

我想JavaScript的「半餡餅」使用同樣的動畫從左正如Flash版本一樣,但無法做到這一點。

有人會這麼善良以幫助嗎?

+0

我不知道如何幫助你,但會看到答案真棒。 – Alex 2011-04-15 13:09:31

+0

居然有一個想法即時工作,看這個空間... – Alex 2011-04-15 13:21:18

回答

2

按照承諾我有一個看看這個,並取得了良好的開端,你,你可以一起工作:

HTML

<div id="graph"><img src="http://ajthomas.co.uk/back.png"></div> 

CSS

#graph{ 
    background:transparent url(http://ajthomas.co.uk/graph.png) no-repeat top left; 
    height:125px; 
    width:290px; 
    overflow:hidden; 
} 

jquery

$("img").rotate({ 
    bind: 
    { 
     click : function() { 
      $(this).rotate({animateTo:180}) 
     } 
    } 
}); 

看到它在行動這裏 - http://jsfiddle.net/ajthomascouk/hWt2v/

它使用了一個名爲「jqueryrotate」插件檢查出來這裏 - http://code.google.com/p/jqueryrotate/

希望這給你一個很好的起點。

Al

+0

非常感謝你 我會盡力並告訴你 仔細 – user709789 2011-04-15 16:10:00

+0

@ user709789你有更新嗎? – Alex 2011-04-18 08:11:30