<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

      <title>Comments on: Where can I find a javascript slider bar widget?</title>
      <link>http://ask.metafilter.com/47622/Where-can-I-find-a-javascript-slider-bar-widget/</link>
      <description>Comments on Ask MetaFilter post Where can I find a javascript slider bar widget?</description>
	  	  <pubDate>Sat, 30 Sep 2006 13:14:36 -0800</pubDate>
      <lastBuildDate>Sat, 30 Sep 2006 13:14:36 -0800</lastBuildDate>
      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>

<item>
  	<title>Question: Where can I find a javascript slider bar widget?</title>
  	<link>http://ask.metafilter.com/47622/Where-can-I-find-a-javascript-slider-bar-widget</link>	
  	<description>I need a javascript slider bar widget with a couple of special features. &lt;br /&gt;&lt;br /&gt; It&apos;s easy enough to find a simple &lt;a href=&quot;http://developer.yahoo.com/yui/examples/slider/&quot;&gt;slider bar&lt;/a&gt; implementation, but I need something that can do the following things:&lt;ol&gt;&lt;li&gt;Have multiple sliders on the same page.&lt;br&gt;
&lt;li&gt;Constrain the possible values for all sliders to a single total.  What I mean is that if I had three sliders, the values of all three would add up to no more than, say, 100.  So, if sliders A, B &amp;amp; C were all at 33, and I moved slider A to 43, then sliders B &amp;amp; C would each automatically re-adjust to 28.&lt;br&gt;
&lt;li&gt;In a perfect world, I would be able to add or subtract sliders from the page by pushing a button.&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br&gt;
I guess I could do this myself in javascript, but I&apos;d rather find somebody else who had done it already and licensed it.  I know I&apos;ve seen controls like this on the Web, but now that I need to find one I&apos;m having no luck.</description>
  	<guid isPermaLink="false">post:ask.metafilter.com,2008:site.47622</guid>
  	<pubDate>Sat, 30 Sep 2006 12:55:40 -0800</pubDate>
  	<dc:creator>Hildago</dc:creator>
	
	<category>javascript</category>
	
	<category>widget</category>
	
	<category>sliders</category>
	
</item>
<item>
  	<title>By: Blazecock Pileon</title>
  	<link>http://ask.metafilter.com/47622/Where-can-I-find-a-javascript-slider-bar-widget#724725</link>	
  	<description>[1]&lt;br&gt;
&lt;br&gt;
I&apos;ve used the free &lt;a href=&quot;http://developer.yahoo.com/yui/slider/&quot;&gt;Yahoo! UI Slider&lt;/a&gt; to add multiple sliders on one page. Email me if you&apos;d like to see a demonstration of this in action.&lt;br&gt;
&lt;br&gt;
The key is to name each slider differently, and I had to modify the JS functions to use my programmatically-named slider widgets. I can email code if you like.&lt;br&gt;
&lt;br&gt;
[2] &lt;br&gt;
&lt;br&gt;
Each slider returns a value into a specifically named variable. On a slider &lt;code&gt;Update&lt;/code&gt; event, you can simply run a function that updates the other named variables to take the value of a fraction of the difference (difference/2 for three sliders, difference/3 for four, etc.).&lt;br&gt;
&lt;br&gt;
[3]&lt;br&gt;
&lt;br&gt;
If you use PHP or another scripting language, along with the &lt;code&gt;hidden&lt;/code&gt; CSS attribute, you can programmatically create hidden slider &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; elements, with names that are programmatically incremented by 1:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;Slider 1 -- [+ onClick=show(Slider_2) ]&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Slider 2 -- [+ onClick=show(Slider_3) ]&lt;/code&gt; etc. &lt;br&gt;
&lt;br&gt;
You would place a [+] button next to an existing slider, which contains an &lt;code&gt;onClick&lt;/code&gt; call to unhide the next slider.&lt;br&gt;
&lt;br&gt;
An explanation of hiding/showing &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;&apos;s is &lt;a href=&quot;http://www.netlobo.com/div_hiding.html&quot;&gt;located here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
I haven&apos;t done this for sliders but I have done this for other chunks of HTML, and the code is along the same lines as described in [1], as far as using a scripting language to automatically write the neccessary hidden &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;&apos;s</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.47622-724725</guid>
  	<pubDate>Sat, 30 Sep 2006 13:14:36 -0800</pubDate>
  	<dc:creator>Blazecock Pileon</dc:creator>
</item>
<item>
  	<title>By: orthogonality</title>
  	<link>http://ask.metafilter.com/47622/Where-can-I-find-a-javascript-slider-bar-widget#724726</link>	
  	<description> &lt;em&gt;&lt;li&gt;Have multiple sliders on the same page.&lt;br&gt;&lt;/li&gt;&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Get rid of global variables, and instead use per-instance member variables.&lt;br&gt;
&lt;br&gt;
&lt;em&gt;&lt;li&gt;Constrain the possible values for all sliders to a single total. What I mean is that if I had three sliders, the values of all three would add up to no more than, say, 100. So, if sliders A, B &amp;amp; C were all at 33, and I moved slider A to 43, then sliders B &amp;amp; C would each automatically re-adjust to 28.&lt;br&gt;&amp;quot;&lt;/li&gt;&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
onchange( newVal, aggregateTotalValue, totalSliders ) {&lt;br&gt;
 var totalOthers = aggregateTotalValue - newVal ;&lt;br&gt;
 var perOthers = totalOthers/totalsliders ;&lt;br&gt;
 // then reset all other sliders&lt;br&gt;
 // a more sophisticated implementation would scale the others, to retain their differences relative to each other&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;em&gt;&lt;li&gt;In a perfect world, I would be able to add or subtract sliders from the page by pushing a button.&lt;/li&gt;&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Again, if you make slider a class, you can use operator new to create additional sliders. In this case, I&apos;d use some class static variables to keep track of the total number of sliders, and to handle updating all sliders on a change in one.&lt;br&gt;
&lt;br&gt;
It&apos;s interesting enough that I&apos;d like to implement it just for the fun of it, but I&apos;m just too busy right now.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.47622-724726</guid>
  	<pubDate>Sat, 30 Sep 2006 13:14:42 -0800</pubDate>
  	<dc:creator>orthogonality</dc:creator>
</item>

    </channel>
</rss>
