2014-02-13 80 views
0

我有以下種類的滑動計算器不工作。jQuery UI元素不工作

enter image description here

不明白爲什麼我不能滑動酒吧這裏是代碼。

<div style="widht: 700px;"> 
<table class="worksheet-table"> 
<tbody> 
<tr><th>Estimated Years to Retirement</th> 
<td> 
<div id="years-to-retirement-caption" class="caption">20 years</div> 
<div id="years-to-retirement-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 19.1919%;"></a></div> 
</td> 
</tr> 
<tr><th>Estimated Years in Retirement</th> 
<td> 
<div id="years-in-retirement-caption" class="caption">25 years</div> 
<div id="years-in-retirement-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 48.9796%;"></a></div> 
</td> 
</tr> 
<tr><th>Desired Annual Income in Retirement<br> <em>(just think about it in today's dollars)</em></th> 
<td> 
<div id="desired-annual-income-caption" class="caption">$80,000</div> 
<div id="desired-annual-income-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 32%;"></a></div> 
</td> 
</tr> 
<tr><th>Retirement Fund Needed</th> 
<td> 
<div id="retirement-fund-needed" class="caption">$2,000,000</div> 
</td> 
</tr> 
</tbody> 
</table> 
<table class="worksheet-table"> 
<tbody> 
<tr class="heading"><th colspan="2">Your Present Situation</th></tr> 
<tr><th>Superannuation</th> 
<td> 
<div id="superannuation-caption" class="caption">$100,000</div> 
<div id="superannuation-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 10%;"></a></div> 
</td> 
</tr> 
<tr><th>Savings (excluding home equity)</th> 
<td> 
<div id="savings-caption" class="caption">$10,000</div> 
<div id="savings-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 1%;"></a></div> 
</td> 
</tr> 
<tr><th>Shares</th> 
<td> 
<div id="shares-caption" class="caption">$20,000</div> 
<div id="shares-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 2%;"></a></div> 
</td> 
</tr> 
<tr><th>Equity Investment in Properties</th> 
<td> 
<div id="equity-caption" class="caption">$0</div> 
<div id="equity-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 0%;"></a></div> 
</td> 
</tr> 
<tr><th>Other</th> 
<td> 
<div id="other-caption" class="caption">$0</div> 
<div id="other-slider" class="slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">&nbsp;<a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 0%;"></a></div> 
</td> 
</tr> 
<tr><th>Today's Total Assets</th> 
<td> 
<div id="current-total-assets" class="caption">$130,000</div> 
</td> 
</tr> 
</tbody> 
</table> 
</div> 

主要頁面的URL是事先

回答

1

http://www.insidewealth.com.au/calculate-your-retirement.html

感謝我假設你已經不叫.slider()的任何地方,但它很難不發佈代碼的話。

$("#years-to-retirement-slider").slider(); // etc 

我假設的任何地方。

還有這裏一個錯字:

<div style="widht: 700px;"> 

寬度,不widht但是這是問題的旁邊。

+0

你可以看看頁面http://www.insidewealth.com.au/calculate-your-retirement.html的查看來源,如果有什麼你可以從中找到?萬分感謝。 – lock

+0

嗯,這是很難刮,但首先確保jQuery-UI加載(你可以檢查它,如果$(「#年 - 退休滑塊」)。滑塊()引發錯誤)。如果不是,在頁面加載時加載它,然後執行$(document).ready($(「#years-to-retirement-slider」)。slider();/*所有其他id直到最後一個*/$(「#other-slider」)。slider();); –