<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Design-Notes &#187; Slider</title>
	<atom:link href="http://design-notes.info/tag/slider/feed/" rel="self" type="application/rss+xml" />
	<link>http://design-notes.info</link>
	<description>Design-Notes</description>
	<lastBuildDate>Wed, 23 Jun 2010 16:08:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Build a simple cost estimator with jQuery UI Slider</title>
		<link>http://design-notes.info/tutorial/jquery-tutorial/build-a-simple-cost-estimator-with-jquery-ui-slider/</link>
		<comments>http://design-notes.info/tutorial/jquery-tutorial/build-a-simple-cost-estimator-with-jquery-ui-slider/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 19:47:24 +0000</pubDate>
		<dc:creator>alexandra</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[Slider]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[UI Design]]></category>

		<guid isPermaLink="false">http://design-notes.info/?p=808</guid>
		<description><![CDATA[I believe everyone is very familiar with jQury UI-JQuery&#8217;s user interface add on. It is a great library and themes are quite fancy, but its lack of documentation often frustrate people especially beginners.Thats why I would like to write a simple tutorial
Lately, I read a post on online tools for designers at a web site [...]]]></description>
			<content:encoded><![CDATA[<p>I believe everyone is very familiar with <a href="http://jqueryui.com/" target="_blank">jQury UI</a>-JQuery&#8217;s user interface add on. It is a great library and themes are quite fancy, but its lack of documentation often frustrate people especially beginners.Thats why I would like to write a simple tutorial</p>
<p>Lately, I read a post on online tools for designers at a web site (can&#8217;t remember which one). One of the tools in the selection is a cost estimator which was very detailed and build with PHP and JavaScript. One problem with this. It was on  a well established  design agency&#8217;s web site. Come on!! who would refer their customers to go to use a cost estimator on a competitor&#8217;s web site? So I came up with my version of  <a href="http://design-notes.info/resources/11-mustknow-free-online-tools-for-web-design-and-development/">free online tools for designers</a>.</p>
<p>Also, I m in the process of building my online portfolio, and came up with an idea of having a simple cost estimator for potential clients. Here is how I did it. Its very simple, definitely beginner level. So don&#8217;t be afraid to read on. As for experts. wait up a more complicated version&#8217;s on its way.</p>
<h2>Header</h2>
<p>Straightforward: link every scripts and make sure ui.slider.js is in the same directory with other js files</p>
<ul>
<li>jquery-ui-1.7.1.custom.css</li>
<li>jquery-1.3.2.js</li>
<li>jquery-ui-1.7.1.custom.min.js</li>
</ul>
<pre class="html"><span class="htmlOtherTag">&lt;title&gt;</span>Simple Cost Estimator<span class="htmlOtherTag">&lt;/title&gt;</span>
<span class="htmlOtherTag">&lt;link type=<span class="htmlAttributeValue">&quot;text/css&quot;</span> href=<span class="htmlAttributeValue">&quot;css/smoothness/jquery-ui-1.7.1.custom.css&quot;</span> rel=<span class="htmlAttributeValue">&quot;stylesheet&quot;</span> /&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;js/jquery-1.3.2.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;js/jquery-ui-1.7.1.custom.min.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span></pre>
<h2>CSS</h2>
<p>I didn&#8217;t stylize much, just need it to work. Basically it is same with the UI default theme.</p>
<pre class="css"><span class="cssSelector">#panel-contents{</span><span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue">relative</span><span class="cssRest">;</span><span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">40px</span><span class="cssRest">;</span><span class="cssSelector">}</span>
<span class="cssSelector">#small-label{</span> <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/small_label.gif) no-repeat</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">4px</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">17px</span><span class="cssRest">;</span> <span class="cssProperty">overflow</span><span class="cssRest">:</span><span class="cssValue">hidden</span><span class="cssRest">;</span><span class="cssProperty">float</span><span class="cssRest">:</span><span class="cssValue">left</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssSelector">#large-label{</span> <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/large_label.gif) no-repeat</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">18px</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">17px</span><span class="cssRest">;</span> <span class="cssProperty">overflow</span><span class="cssRest">:</span><span class="cssValue">hidden</span><span class="cssRest">;</span><span class="cssProperty">float</span><span class="cssRest">:</span><span class="cssValue">left</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssSelector">#slider-bar{</span> <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/slider.gif) no-repeat</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">4px</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">100px</span><span class="cssRest">;</span> <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue">relative</span><span class="cssRest">;</span> <span class="cssProperty">float</span><span class="cssRest">:</span><span class="cssValue">left</span><span class="cssRest">;</span><span class="cssSelector">}</span>
<span class="cssSelector">#slider-handle{</span> <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/slider_handle.gif) no-repeat</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">12px</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">13px</span><span class="cssRest">;</span> <span class="cssProperty">overflow</span><span class="cssRest">:</span><span class="cssValue">hidden</span><span class="cssRest">;</span><span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue">absolute</span><span class="cssRest">;</span>z-index:1;<span class="cssSelector">}</span>
<span class="cssSelector">#slider-bubble{</span> <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/callout.gif) no-repeat</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">46px</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">38px</span><span class="cssRest">;</span> <span class="cssProperty">overflow</span><span class="cssRest">:</span><span class="cssValue">hidden</span><span class="cssRest">;</span> <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue">absolute</span><span class="cssRest">;</span> <span class="cssProperty">top</span><span class="cssRest">:</span><span class="cssValue">-50px</span><span class="cssRest">;</span><span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue">8px 0 0 0</span><span class="cssRest">;</span><span class="cssProperty">text-align</span><span class="cssRest">:</span><span class="cssValue">center</span><span class="cssRest">;</span><span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue">bold</span><span class="cssRest">;</span><span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue">#202020</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssSelector">#box{</span><span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue">absolute</span><span class="cssRest">;</span> <span class="cssProperty">left</span><span class="cssRest">:</span><span class="cssValue">40px</span><span class="cssRest">;</span><span class="cssProperty">background-color</span><span class="cssRest">:</span><span class="cssValue">#202020</span><span class="cssRest">;</span><span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">200px</span><span class="cssRest">;</span><span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">200px</span><span class="cssRest">;</span><span class="cssSelector">}</span>
<span class="cssSelector">#container{</span><span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">700px</span><span class="cssRest">;</span> <span class="cssProperty">margin</span><span class="cssRest">:</span><span class="cssValue">auto</span><span class="cssRest">;</span><span class="cssSelector">}</span>
<span class="cssSelector">input{</span><span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 1em</span><span class="cssRest">;</span><span class="cssSelector">}</span>
<span class="cssSelector">#rate{</span><span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">#bfbfbf</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">4em</span><span class="cssRest">;</span> <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue">0 3px</span><span class="cssRest">;</span><span class="cssSelector">}</span></pre>
<h2>JavaScript: The slider controls page number which is from 0 to 20.</h2>
<ul>
<li>value:initial value</li>
<li>min:minimum value(0)</li>
<li>max: maximum value(20)</li>
<li>step: the amount of each interval(1). This means it slides one for each step, and we have 20 steps</li>
<li>#amount is page amount</li>
<li>Price=rate x amount</li>
<li>(ui.value) is slider&#8217;s current value, when you slide it</li>
<li>slider(&#8220;value&#8221;) means slider&#8217;s initial value which is 0</li>
<li>here is how to calculate price in javascript: $ sign plus ui current value multiply rate input value.
<pre class="js">'$'+ui.value*$("#rate").attr("value")</pre>
</li>
<li>last two line&#8217;s function is to set everything back to 0 (as our initial value is 0) after refreshing</li>
</ul>
<pre class="js">&lt;script type="text/javascript"&gt;
$(function() {
$("#slider").slider({
value:0,
min: 0,
max: 20,
step: 1,
slide: function(event, ui) {
$("#amount").val(ui.value);
$("#price").val('$'+ui.value*$("#rate").attr("value"));
}
});
$("#amount").val($("#slider").slider("value"));
$("#price").val('$' + $("#slider").slider("value"));
});
&lt;/script&gt;</pre>
<h2>HTML</h2>
<h3>step1 call the slider</h3>
<pre class="html"><span class="htmlOtherTag">&lt;h1&gt;</span>Build yourself a cost estimator with jQuery UI<span class="htmlOtherTag">&lt;/h1&gt;</span>
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;slider&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span></pre>
<h3>step2: write three input fields</h3>
<pre class="html"><span class="htmlOtherTag">&lt;p&gt;</span>
<span class="htmlOtherTag">&lt;label for=<span class="htmlAttributeValue">&quot;rate&quot;</span>&gt;</span>Rate in US dollar:<span class="htmlOtherTag">&lt;/label&gt;</span>
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> id=<span class="htmlAttributeValue">&quot;rate&quot;</span> style=<span class="htmlAttributeValue">&quot;<span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue">0; color:#f6931f</span><span class="cssRest">;</span> <span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue">bold</span><span class="cssRest">;</span>&quot;</span> /&gt;</span>
<span class="htmlOtherTag">&lt;label for=<span class="htmlAttributeValue">&quot;amount&quot;</span>&gt;</span>Page number:<span class="htmlOtherTag">&lt;/label&gt;</span>
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> id=<span class="htmlAttributeValue">&quot;amount&quot;</span> style=<span class="htmlAttributeValue">&quot;<span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue">0; color:#f6931f</span><span class="cssRest">;</span> <span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue">bold</span><span class="cssRest">;</span>&quot;</span> /&gt;</span>
<span class="htmlOtherTag">&lt;/p&gt;</span>
<span class="htmlOtherTag">&lt;p&gt;</span>
<span class="htmlOtherTag">&lt;label for=<span class="htmlAttributeValue">&quot;price&quot;</span>&gt;</span>Price:<span class="htmlOtherTag">&lt;/label&gt;</span>
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> id=<span class="htmlAttributeValue">&quot;price&quot;</span> style=<span class="htmlAttributeValue">&quot;<span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue">0; color:#f6931f</span><span class="cssRest">;</span> <span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue">bold</span><span class="cssRest">;</span>&quot;</span> /&gt;</span>
<span class="htmlOtherTag">&lt;/p&gt;</span></pre>
<p>Finally, this is the <a href="http://design-notes.info/demo/cost/costestimator.html">result.</a></p>
<p>You might want to read more on using<a title="How to creat a Feature Article slide " href="http://design-notes.info/tutorial/jquery-tutorial/how-to-creat-a-feature-article-slide-show-with-thumbnails-and-indicator/" target="_self"> jQuery Cycle and jCarousel in my other tutorial</a></p>
<p>Also, there are more good tutorials at <a href="http://www.learningjquery.com/" target="_blank">learningjquery.com</a></p>



ADD TO<a href="#" onclick="javascript:(function(){EN_CLIP_HOST='http://www.evernote.com';try{var x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();"><img src="http://img44.imageshack.us/img44/3714/picture4p.png" alt="Add To Evernote" /></a>  If this helps, why not tell your friends?


	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;title=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider" title="Reddit"><img src="http://design-notes.info/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;title=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider&amp;notes=I%20believe%20everyone%20is%20very%20familiar%20with%20jQury%20UI-JQuery%27s%20user%20interface%20add%20on.%20It%20is%20a%20great%20library%20and%20themes%20are%20quite%20fancy%2C%20but%20its%20lack%20of%20documentation%20often%20frustrate%20people%20especially%20beginners.Thats%20why%20I%20would%20like%20to%20write%20a%20simple%20tut" title="del.icio.us"><img src="http://design-notes.info/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;title=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider" title="StumbleUpon"><img src="http://design-notes.info/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;t=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider" title="Facebook"><img src="http://design-notes.info/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F" title="Technorati"><img src="http://design-notes.info/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;title=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider" title="Design Float"><img src="http://design-notes.info/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F" title="Identi.ca"><img src="http://design-notes.info/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider&amp;link=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F" title="FriendFeed"><img src="http://design-notes.info/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;submitHeadline=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider&amp;submitSummary=I%20believe%20everyone%20is%20very%20familiar%20with%20jQury%20UI-JQuery%27s%20user%20interface%20add%20on.%20It%20is%20a%20great%20library%20and%20themes%20are%20quite%20fancy%2C%20but%20its%20lack%20of%20documentation%20often%20frustrate%20people%20especially%20beginners.Thats%20why%20I%20would%20like%20to%20write%20a%20simple%20tut&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://design-notes.info/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fjquery-tutorial%2Fbuild-a-simple-cost-estimator-with-jquery-ui-slider%2F&amp;title=Build%20a%20simple%20cost%20estimator%20with%20jQuery%20UI%20Slider&amp;body=I%20believe%20everyone%20is%20very%20familiar%20with%20jQury%20UI-JQuery%27s%20user%20interface%20add%20on.%20It%20is%20a%20great%20library%20and%20themes%20are%20quite%20fancy%2C%20but%20its%20lack%20of%20documentation%20often%20frustrate%20people%20especially%20beginners.Thats%20why%20I%20would%20like%20to%20write%20a%20simple%20tut" title="Ping.fm"><img src="http://design-notes.info/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://design-notes.info/tutorial/jquery-tutorial/build-a-simple-cost-estimator-with-jquery-ui-slider/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
