PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/forms-controls/tabselect/index.html

https://bitbucket.org/vins13pattar/handpicked.jquery.plugins.repo
HTML | 424 lines | 253 code | 65 blank | 106 comment | 0 complexity | 8045b4c80ba7679683ae759dd58e8a52 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  5. <meta http-equiv="imagetoolbar" content="no" />
  6. <title>TabSelect jQuery Plugin</title>
  7. <link href='http://fonts.googleapis.com/css?family=Quattrocento' rel='stylesheet' type='text/css'>
  8. <link href="prettify.css" type="text/css" rel="stylesheet" />
  9. <script type="text/javascript" src="prettify.js"></script>
  10. <link rel="stylesheet" type="text/css" href="global.css" />
  11. <!--
  12. http://iwantaneff.in/repo/
  13. .g`
  14. j#
  15. f ]0#
  16. ,& M0#
  17. ]0 00#
  18. 00 00#
  19. , #00 000f
  20. y# ]000 0000
  21. _0^ 0000 M0000
  22. p00 0000 0000&_
  23. j00f _0000 400000g
  24. _000f 00000_ M00000&_
  25. .0000f 000008 ]000000gq p
  26. ]0000f M00000f `M000000NN,, ,j0!
  27. 00000f 00000M *M00000000MMMMMMMMM0M`
  28. 00000f 000000# ]@00000000000000M
  29. 000000f ]000000I !@FM00@M@F
  30. 000000f ~0000000g
  31. 0000000 #00000008
  32. 0000000 00000000&
  33. 0000000# #00000000, +
  34. 00000000r ^000000000pg _pf
  35. 000000001 ~0000000000&g_ _j0^
  36. ~00000000_ `R0000000000&g_ _j00~
  37. 000000000, ~000000000000Ngg_, __jg000!
  38. 400000000& `M000000000000000MM&,,,,,,,jNN00000M`
  39. *000000000M `#00000000000000000000000000000M`
  40. 0000000000#, "M000000000000000000000000M!
  41. 00000000000 !@Q0000000000000000@@!
  42. ]00000000000, `MMFMMFMMFMMF'
  43. #00000000000L
  44. 000000000000#,
  45. 0000000000000p y
  46. `00000000000000N_ _p
  47. 000000000000000g__ _j0f
  48. #000000000000000&p_ _j0M^
  49. ~00000000000000000gg_ _jg000f
  50. M0000000000000000000M1_, __jN0000M`
  51. ]M000000000000000000000MMMM,,,,,,,,,,#MMM0000000T
  52. "0000000000000000000000000000000000000000000M
  53. M00000000000000000000000000000000000000M
  54. MM0000000000000000000000000000000009
  55. ~#00000000000000000000000000P~!
  56. ~~M000000000000000000M~~
  57. ~~~~~~~~~~'
  58. -->
  59. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script>window.jQuery || document.write('<script src="../../../jquery.1.7.2.min.js"><\/script>')</script>
  60. <script type="text/javascript" src="jquery.tabselect-0.2.js"></script>
  61. <style type="text/css">
  62. <!--
  63. div.demo span span {
  64. font-weight: normal;
  65. letter-spacing: 1px;
  66. text-decoration: none;
  67. padding: 2px;
  68. padding-left: 4px;
  69. padding-right: 4px;
  70. padding-bottom: 1px;
  71. margin-right: 6px;
  72. cursor: hand;
  73. cursor: pointer;
  74. text-shadow: 0 1px 1px rgba(0,0,0,.3);
  75. -webkit-border-radius: .2em;
  76. -moz-border-radius: .2em;
  77. border-radius: .2em;
  78. -webkit-box-shadow: 0 1px 2px rgba(160,160,160,1);
  79. -moz-box-shadow: 0 1px 2px rgba(160,160,160,1);
  80. box-shadow: 0 1px 2px rgba(160,160,160,1);
  81. }
  82. div.demo span.active {
  83. background: #99cc33;
  84. color: #fff;
  85. border: 1px #66aa00 solid;
  86. }
  87. div.demo span.active:hover {
  88. background: #66aa00;
  89. color: #fff;
  90. border: 1px #338800 solid;
  91. }
  92. div.demo span.inactive {
  93. background: #ddd;
  94. color: #888;
  95. border: 1px #bbb solid;
  96. }
  97. div.demo span.inactive:hover {
  98. background: #bbb;
  99. color: #fff;
  100. border: 1px #888 solid;
  101. }
  102. -->
  103. </style>
  104. <script type="text/javascript">
  105. var languages = ["de","fr","en","es","it"];
  106. var cars = ["Audi","Fiat","Ford","Peugeot","Ferrari"];
  107. $(document).ready(function(){
  108. prettyPrint(); // Google Code Prettify
  109. $('#langtabs').tabSelect({
  110. tabElements: languages,
  111. selectedTabs: [ 'de', 'en' ]
  112. });
  113. $('#cartabs1').tabSelect({
  114. tabElements: cars,
  115. selectedTabs: [ ]
  116. });
  117. $('#cartabs2').tabSelect({
  118. tabElements: cars,
  119. selectedTabs: 'all'
  120. });
  121. $('#cartabs3').tabSelect({
  122. tabElements: cars,
  123. formElement: '#myinput'
  124. });
  125. $('#cartabs4').tabSelect({
  126. tabElements: cars,
  127. formElement: '#myselect'
  128. });
  129. $('#cartabs5').tabSelect({
  130. tabElements: cars,
  131. formElement: '#myhiddeninput',
  132. onChange: function(selection){
  133. console.log($('#myhiddeninput').val());
  134. }
  135. });
  136. $('#cartabs6').tabSelect({
  137. tabElements: cars,
  138. selectedTabs: [ 'Fiat', 'Ford' ]
  139. });
  140. });
  141. </script>
  142. </head>
  143. <body>
  144. <div id="pluginnav">
  145. <div>
  146. <a href="index.php" class="overview">jQuery Plugins by Fredi Bach:</a>
  147. <a href="inputnotes.php">InputNotes</a>,
  148. <a href="autoanchors.php">AutoAnchors</a>,
  149. <a href="randomclass.php">RandomClass</a>,
  150. <a href="removeoverflow.php">RemoveOverflow</a>,
  151. <a href="aparthide.php">aPartHide</a>,
  152. <a href="tabselect.php">TabSelect</a>,
  153. <a href="defaultstagger.php">DefaultsTagger</a>,
  154. <a href="selectswitcher.php">SelectSwitcher</a>,
  155. <a href="livingfade.php">LivingFade</a>,
  156. <a href="slideinreplace.php">SlideInReplace</a>,
  157. <a href="waveanimate.php">WaveAnimate</a>
  158. </div>
  159. </div> <div id="container">
  160. <h1>TabSelect jQuery Plugin</h1>
  161. <p>
  162. A plugin to select one or more array or form entries visually, for example to filter a list or replace a multiselect form element.
  163. </p>
  164. <p class="contentnav">
  165. <a href="#demo">Demo</a>
  166. <a href="#usage">Usage</a>
  167. <a href="#styling">Styling</a>
  168. <a href="#download">Download</a>
  169. <a href="#compatibility">Compatibility</a>
  170. <a href="#changelog">Changelog</a>
  171. </p>
  172. <h2 id="demo">Demo</h2>
  173. <p>
  174. In this first demo you can see the basic usage of the plugin. You have an array of possible values and you define the initial selection.
  175. If you click on one of the options, the state toggles:
  176. </p>
  177. <div class="demo">
  178. <span id="langtabs"></span>
  179. </div>
  180. <p>
  181. In the next demo we use a different array with car manufacturers. You can use the plugin as often as you want and everytime with different settings.
  182. In this case we initialize the plugin without anything selected:
  183. </p>
  184. <div class="demo">
  185. <span id="cartabs1"></span>
  186. </div>
  187. <p>
  188. You can of course start with everything selected, it's up to you:
  189. </p>
  190. <div class="demo">
  191. <span id="cartabs2"></span>
  192. </div>
  193. <p>
  194. In all above examples, we've defined the selection in the initialization of the plugin. Another way to do it is by using
  195. a text input as the source for the selection:
  196. </p>
  197. <div class="demo">
  198. <input type="text" id="myinput" name="myinput" value="Audi,Ford" size=30>
  199. <span id="cartabs3"></span>
  200. </div>
  201. <p>
  202. If you toggle an option, the text changes automatically, in other words, you can use that text field in a form to submit the selection. In such a case
  203. you would of course hide the text field first. Multi selects are fine as well, if you don't want comma separated returns:
  204. </p>
  205. <div class="demo">
  206. <select id="myselect" name="myselect" MULTIPLE SIZE=5>
  207. <option value="Audi" selected>Audi</option>
  208. <option value="Fiat">Fiat</option>
  209. <option value="Ford">Ford</option>
  210. <option value="Peugeot">Peugeot</option>
  211. <option value="Ferrari" selected>Ferrari</option>
  212. </select>
  213. <span id="cartabs4"></span>
  214. </div>
  215. <p>
  216. Here's one where the textfield is hidden and this example has an additional onChange callback that outputs the selection in your
  217. firebug console:
  218. </p>
  219. <div class="demo">
  220. <input type="hidden" id="myhiddeninput" name="myhiddeninput" value="Audi,Ford">
  221. <span id="cartabs5"></span>
  222. </div>
  223. <p>
  224. Additionally the plugin supports slecting all or selecting no options as demonstrated in this demo:
  225. </p>
  226. <div class="demo">
  227. <span id="cartabs6"></span>
  228. &nbsp;
  229. <a href="javascript:void(null);" onclick="$('#cartabs6').data('tabSelect').selectAll();">select all</a>
  230. &nbsp;
  231. <a href="javascript:void(null);" onclick="$('#cartabs6').data('tabSelect').deselectAll();">select none</a>
  232. </div>
  233. <h2 id="usage">Usage</h2>
  234. <p>This is how we called the plugin for the first demo (the one with the languages):</p>
  235. <pre class="prettyprint lang-js">
  236. var languages = ["de","fr","en","es","it"];
  237. $('#langtabs').tabSelect({
  238. tabElements: languages,
  239. selectedTabs: [ 'de', 'en' ]
  240. });
  241. </pre>
  242. <p>This is how we made the first car example, note the empty selection:</p>
  243. <pre class="prettyprint lang-js">
  244. var cars = ["Audi","Fiat","Ford","Peugeot","Ferrari"];
  245. $('#cartabs1').tabSelect({
  246. tabElements: cars,
  247. selectedTabs: [ ]
  248. });
  249. </pre>
  250. <p>This is how you select all:</p>
  251. <pre class="prettyprint lang-js">
  252. $('#cartabs2').tabSelect({
  253. tabElements: cars,
  254. selectedTabs: 'all'
  255. });
  256. </pre>
  257. <p>Check the source of this page for the rest of the demos. They are pretty straight forward.</p>
  258. <h2 id="styling">Styling</h2>
  259. <p>
  260. You're completely free to style your elements. Default setting for the tabs is a span element, but you can change that in the settings
  261. (check the plugin source, the default settings are right at the top). Here's the styling I used for the demos:
  262. </p>
  263. <pre class="prettyprint lang-js">
  264. div.demo span span {
  265. font-weight: normal;
  266. letter-spacing: 1px;
  267. text-decoration: none;
  268. padding: 2px;
  269. padding-left: 4px;
  270. padding-right: 4px;
  271. padding-bottom: 1px;
  272. margin-right: 6px;
  273. cursor: hand;
  274. cursor: pointer;
  275. text-shadow: 0 1px 1px rgba(0,0,0,.3);
  276. -webkit-border-radius: .2em;
  277. -moz-border-radius: .2em;
  278. border-radius: .2em;
  279. -webkit-box-shadow: 0 1px 2px rgba(160,160,160,1);
  280. -moz-box-shadow: 0 1px 2px rgba(160,160,160,1);
  281. box-shadow: 0 1px 2px rgba(160,160,160,1);
  282. }
  283. div.demo span.active {
  284. background: #99cc33;
  285. color: #fff;
  286. border: 1px #66aa00 solid;
  287. }
  288. div.demo span.active:hover {
  289. background: #66aa00;
  290. color: #fff;
  291. border: 1px #338800 solid;
  292. }
  293. div.demo span.inactive {
  294. background: #ddd;
  295. color: #888;
  296. border: 1px #bbb solid;
  297. }
  298. div.demo span.inactive:hover {
  299. background: #bbb;
  300. color: #fff;
  301. border: 1px #888 solid;
  302. }
  303. </pre>
  304. <h2 id="download">Download</h2>
  305. <p>Current version: <a href="js/jquery.tabselect-0.2.js">jquery.tabselect-0.2.js</a> (3.9k not minified)</p>
  306. <h2 id="compatibility">Compatibility</h2>
  307. <p>
  308. Tested in:
  309. <ul>
  310. <li>Internet Explorer 6 and 7</li>
  311. <li>Firefox 3.5+</li>
  312. <li>Safari 4+</li>
  313. <li>Google Chrome</li>
  314. <li>Opera 9.6</li>
  315. </ul>
  316. With:
  317. <ul>
  318. <li>jQuery 1.5</li>
  319. <li>jQuery 1.4</li>
  320. <li>jQuery 1.3.2</li>
  321. </ul>
  322. <p>There really is nothing complicated in there, so expect the plugin to work in older browsers as well.</p>
  323. </p>
  324. <h2 id="changelog">Changelog</h2>
  325. <p>
  326. <ul>
  327. <li>0.2: First official release</li>
  328. </ul>
  329. </p>
  330. <div id="footer">Copyright (c) 2011 Fredi Bach - <a href="http://fredibach.ch" target="_blank">fredibach.ch</a></div>
  331. </div>
  332. <script type="text/javascript">
  333. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  334. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  335. </script>
  336. <script type="text/javascript">
  337. try {
  338. var pageTracker = _gat._getTracker("UA-15334778-1");
  339. pageTracker._trackPageview();
  340. } catch(err) {}</script>
  341. </body>
  342. </html>