right-to-left.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Right to left &middot; Isotope </title>
  6. <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
  7. <link rel="stylesheet" href="../css/style.css" />
  8. <!-- scripts at bottom of page -->
  9. </head>
  10. <body class="tests demos">
  11. <nav id="site-nav">
  12. <h1><a href="../index.html">Isotope</a></h1>
  13. <h2>Docs</h2>
  14. <ul>
  15. <li><a href="../docs/introduction.html">Introduction</a>
  16. <li><a href="../docs/options.html">Options</a>
  17. <li><a href="../docs/methods.html">Methods</a>
  18. <li><a href="../docs/layout-modes.html">Layout modes</a>
  19. <li><a href="../docs/filtering.html">Filtering</a>
  20. <li><a href="../docs/sorting.html">Sorting</a>
  21. <li><a href="../docs/animating.html">Animating</a>
  22. <li><a href="../docs/adding-items.html">Adding items</a>
  23. <li><a href="../docs/extending-isotope.html">Extending Isotope</a>
  24. <li><a href="../docs/hash-history-jquery-bbq.html">Hash history with jQuery BBQ</a>
  25. <li><a href="../docs/help.html">Help</a>
  26. <li><a href="../docs/license.html">License</a>
  27. </ul>
  28. <h2>Demos</h2>
  29. <ul>
  30. <li><a href="../demos/basic.html">Basic</a>
  31. <li><a href="../demos/elements-complete.html">Elements Complete</a>
  32. <li><a href="../demos/elements-partial.html">Elements Partial</a>
  33. <li><a href="../demos/layout-modes.html">Layout modes</a>
  34. <li><a href="../demos/filtering.html">Filtering</a>
  35. <li><a href="../demos/sorting.html">Sorting</a>
  36. <li><a href="../demos/relayout.html">reLayout</a>
  37. <li><a href="../demos/adding-items.html">Adding items</a>
  38. <li><a href="../demos/infinite-scroll.html">Infinite Scroll</a>
  39. <li><a href="../demos/images.html">Images</a>
  40. <li><a href="../demos/combination-filters.html">Combination filters</a>
  41. <li><a href="../demos/hash-history.html">Hash history</a>
  42. <li><a href="../demos/fluid-responsive.html">Fluid / responsive</a>
  43. </ul>
  44. <h2>Custom layout modes</h2>
  45. <ul>
  46. <li><a href="../custom-layout-modes/centered-masonry.html">Centered Masonry</a>
  47. <li><a href="../custom-layout-modes/category-rows.html">Category rows</a>
  48. <li><a href="../custom-layout-modes/masonry-corner-stamp.html">Masonry corner stamp</a>
  49. <li><a href="../custom-layout-modes/masonry-gutters.html">Masonry gutters</a>
  50. <li><a href="../custom-layout-modes/spine-align.html">Spine align</a>
  51. </ul>
  52. <h2><a href="../tests/index.html">Tests</a></h2>
  53. </nav> <!-- #site-nav -->
  54. <section id="content">
  55. <h1>Right to left</h1>
  56. <style>
  57. #content { direction: rtl; }
  58. #options li { float: right; }
  59. .isotope .isotope-item {
  60. -webkit-transition-property: right, top, -webkit-transform, opacity;
  61. -moz-transition-property: right, top, -moz-transform, opacity;
  62. -o-transition-property: right, top, -o-transform, opacity;
  63. transition-property: right, top, transform, opacity;
  64. }
  65. </style>
  66. <section id="copy">
  67. <p>Isotope can support right-to-left layouts for languages like Hebrew and Arabic. See docs: <a href="../docs/help.html#righttoleft_layouts">Help - Right to left layouts</a>.</p>
  68. </section>
  69. <section id="options" class="clearfix">
  70. <h3>Filters</h3>
  71. <ul id="filters" class="option-set clearfix" data-option-key="filter">
  72. <li><a href="#filter" data-option-value="*" class="selected">show all</a></li>
  73. <li><a href="#filter" data-option-value=".metal">metal</a></li>
  74. <li><a href="#filter" data-option-value=".transition">transition</a></li>
  75. <li><a href="#filter" data-option-value=".post-transition">post-transition</a></li>
  76. <li><a href="#filter" data-option-value=".nonmetal">nonmetal</a></li>
  77. <li><a href="#filter" data-option-value=".inner-transition">inner-transition</a></li>
  78. <li><a href="#filter" data-option-value=".alkali, .alkaline-earth">alkali and alkaline-earth</a></li>
  79. <li><a href="#filter" data-option-value=":not(.transition)">not transition</a></li>
  80. <li><a href="#filter" data-option-value=".metal:not(.transition)">metal but not transition</a></li>
  81. </ul>
  82. <h3>Sort</h3>
  83. <ul id="sort-by" class="option-set clearfix" data-option-key="sortBy">
  84. <li><a href="#sortBy=original-order" data-option-value="original-order" class="selected" data>original-order</a></li>
  85. <li><a href="#sortBy=name" data-option-value="name">name</a></li>
  86. <li><a href="#sortBy=symbol" data-option-value="symbol">symbol</a></li>
  87. <li><a href="#sortBy=number" data-option-value="number">number</a></li>
  88. <li><a href="#sortBy=weight" data-option-value="weight">weight</a></li>
  89. <li><a href="#sortBy=category" data-option-value="category">category</a></li>
  90. <li><a href="#sortBy=random" data-option-value="random">random</a></li>
  91. </ul>
  92. <h3>Sort direction</h3>
  93. <ul id="sort-direction" class="option-set clearfix" data-option-key="sortAscending">
  94. <li><a href="#sortAscending=true" data-option-value="true" class="selected">sort ascending</a></li>
  95. <li><a href="#sortAscending=false" data-option-value="false">sort descending</a></li>
  96. </ul>
  97. <h3>Layout modes</h3>
  98. <ul id="layouts" class="option-set clearfix" data-option-key="layoutMode">
  99. <li><a href="#masonry" data-option-value="masonry" class="selected">masonry</a></li>
  100. <li><a href="#fitRows" data-option-value="fitRows">fitRows</a></li>
  101. <li><a href="#cellsByRow" data-option-value="cellsByRow">cellsByRow</a></li>
  102. <li><a href="#straightDown" data-option-value="straightDown">straightDown</a></li>
  103. <li><a href="#masonryHorizontal" data-option-value="masonryHorizontal" class="horizontal">masonryHorizontal</a></li>
  104. <li><a href="#fitColumns" data-option-value="fitColumns" class="horizontal">fitColumns</a></li>
  105. <li><a href="#cellsByColumn" data-option-value="cellsByColumn" class="horizontal">cellsByColumn</a></li>
  106. <li><a href="#straightAcross" data-option-value="straightAcross" class="horizontal">straightAcross</a></li>
  107. </ul>
  108. <h3>Etc</h3>
  109. <ul id="etc" class="clearfix">
  110. <li id="toggle-sizes"><a href="#toggle-sizes">Toggle variable sizes</a></li>
  111. <li id="insert"><a href="#insert">Insert new elements</a></li>
  112. <li id="append"><a href='#append'>Append new elements</a></li>
  113. <li id="shuffle"><a href='#shuffle'>Shuffle</a></li>
  114. </ul>
  115. </section> <!-- #options -->
  116. <div id="container" class="clickable clearfix">
  117. <div class="element transition metal " data-symbol="Hg" data-category="transition">
  118. <p class="number">80</p>
  119. <h3 class="symbol">Hg</h3>
  120. <h2 class="name">Mercury</h2>
  121. <p class="weight">200.59</p>
  122. </div>
  123. <div class="element metalloid " data-symbol="Te" data-category="metalloid">
  124. <p class="number">52</p>
  125. <h3 class="symbol">Te</h3>
  126. <h2 class="name">Tellurium</h2>
  127. <p class="weight">127.6</p>
  128. </div>
  129. <div class="element post-transition metal " data-symbol="Bi" data-category="post-transition">
  130. <p class="number">83</p>
  131. <h3 class="symbol">Bi</h3>
  132. <h2 class="name">Bismuth</h2>
  133. <p class="weight">208.9804</p>
  134. </div>
  135. <div class="element transition metal " data-symbol="Cd" data-category="transition">
  136. <p class="number">48</p>
  137. <h3 class="symbol">Cd</h3>
  138. <h2 class="name">Cadmium</h2>
  139. <p class="weight">112.411</p>
  140. </div>
  141. <div class="element alkaline-earth metal " data-symbol="Ca" data-category="alkaline-earth">
  142. <p class="number">20</p>
  143. <h3 class="symbol">Ca</h3>
  144. <h2 class="name">Calcium</h2>
  145. <p class="weight">40.078</p>
  146. </div>
  147. <div class="element transition metal " data-symbol="Re" data-category="transition">
  148. <p class="number">75</p>
  149. <h3 class="symbol">Re</h3>
  150. <h2 class="name">Rhenium</h2>
  151. <p class="weight">186.207</p>
  152. </div>
  153. <div class="element post-transition metal " data-symbol="Tl" data-category="post-transition">
  154. <p class="number">81</p>
  155. <h3 class="symbol">Tl</h3>
  156. <h2 class="name">Thallium</h2>
  157. <p class="weight">204.3833</p>
  158. </div>
  159. <div class="element metalloid " data-symbol="Sb" data-category="metalloid">
  160. <p class="number">51</p>
  161. <h3 class="symbol">Sb</h3>
  162. <h2 class="name">Antimony</h2>
  163. <p class="weight">121.76</p>
  164. </div>
  165. <div class="element transition metal " data-symbol="Co" data-category="transition">
  166. <p class="number">27</p>
  167. <h3 class="symbol">Co</h3>
  168. <h2 class="name">Cobalt</h2>
  169. <p class="weight">58.933195</p>
  170. </div>
  171. <div class="element lanthanoid metal inner-transition " data-symbol="Lu" data-category="lanthanoid">
  172. <p class="number">71</p>
  173. <h3 class="symbol">Lu</h3>
  174. <h2 class="name">Lutetium</h2>
  175. <p class="weight">174.9668</p>
  176. </div>
  177. <div class="element noble-gas nonmetal " data-symbol="Ar" data-category="noble-gas">
  178. <p class="number">18</p>
  179. <h3 class="symbol">Ar</h3>
  180. <h2 class="name">Argon</h2>
  181. <p class="weight">39.948</p>
  182. </div>
  183. <div class="element alkali metal " data-symbol="Rb" data-category="alkali">
  184. <p class="number">37</p>
  185. <h3 class="symbol">Rb</h3>
  186. <h2 class="name">Rubidium</h2>
  187. <p class="weight">85.4678</p>
  188. </div>
  189. <div class="element other nonmetal " data-symbol="N" data-category="other">
  190. <p class="number">7</p>
  191. <h3 class="symbol">N</h3>
  192. <h2 class="name">Nitrogen</h2>
  193. <p class="weight">14.0067</p>
  194. </div>
  195. <div class="element actinoid metal inner-transition " data-symbol="Np" data-category="actinoid">
  196. <p class="number">93</p>
  197. <h3 class="symbol">Np</h3>
  198. <h2 class="name">Neptunium</h2>
  199. <p class="weight">(237)</p>
  200. </div>
  201. <div class="element actinoid metal inner-transition " data-symbol="Ac" data-category="actinoid">
  202. <p class="number">89</p>
  203. <h3 class="symbol">Ac</h3>
  204. <h2 class="name">Actinium</h2>
  205. <p class="weight">(227)</p>
  206. </div>
  207. </div>
  208. <script src="../js/jquery-1.6.4.min.js"></script>
  209. <script src="../jquery.isotope.min.js"></script>
  210. <script src="../js/fake-element.js"></script>
  211. <script>
  212. $.Isotope.prototype._positionAbs = function( x, y ) {
  213. return { right: x, top: y };
  214. };
  215. $(function(){
  216. var $container = $('#container');
  217. // add randomish size classes
  218. $container.find('.element').each(function(){
  219. var $this = $(this),
  220. number = parseInt( $this.find('.number').text(), 10 );
  221. if ( number % 7 % 2 === 1 ) {
  222. $this.addClass('width2');
  223. }
  224. if ( number % 3 === 0 ) {
  225. $this.addClass('height2');
  226. }
  227. });
  228. $container.isotope({
  229. itemSelector : '.element',
  230. transformsEnabled: false,
  231. masonry : {
  232. columnWidth : 120
  233. },
  234. masonryHorizontal : {
  235. rowHeight: 120
  236. },
  237. cellsByRow : {
  238. columnWidth : 240,
  239. rowHeight : 240
  240. },
  241. cellsByColumn : {
  242. columnWidth : 240,
  243. rowHeight : 240
  244. },
  245. getSortData : {
  246. symbol : function( $elem ) {
  247. return $elem.attr('data-symbol');
  248. },
  249. category : function( $elem ) {
  250. return $elem.attr('data-category');
  251. },
  252. number : function( $elem ) {
  253. return parseInt( $elem.find('.number').text(), 10 );
  254. },
  255. weight : function( $elem ) {
  256. return parseFloat( $elem.find('.weight').text().replace( /[\(\)]/g, '') );
  257. },
  258. name : function ( $elem ) {
  259. return $elem.find('.name').text();
  260. }
  261. }
  262. });
  263. var $optionSets = $('#options .option-set'),
  264. $optionLinks = $optionSets.find('a');
  265. $optionLinks.click(function(){
  266. var $this = $(this);
  267. // don't proceed if already selected
  268. if ( $this.hasClass('selected') ) {
  269. return false;
  270. }
  271. var $optionSet = $this.parents('.option-set');
  272. $optionSet.find('.selected').removeClass('selected');
  273. $this.addClass('selected');
  274. // make option object dynamically, i.e. { filter: '.my-filter-class' }
  275. var options = {},
  276. key = $optionSet.attr('data-option-key'),
  277. value = $this.attr('data-option-value');
  278. // parse 'false' as false boolean
  279. value = value === 'false' ? false : value;
  280. options[ key ] = value;
  281. if ( key === 'layoutMode' && changeLayoutMode ) {
  282. // changes in layout modes need extra logic
  283. changeLayoutMode( $this, options )
  284. } else {
  285. // otherwise, apply new options
  286. $container.isotope( options );
  287. }
  288. return false;
  289. });
  290. // change layout
  291. var isHorizontal = false;
  292. function changeLayoutMode( $link, options ) {
  293. var wasHorizontal = isHorizontal;
  294. isHorizontal = $link.hasClass('horizontal');
  295. if ( wasHorizontal !== isHorizontal ) {
  296. // orientation change
  297. // need to do some clean up for transitions and sizes
  298. var style = isHorizontal ?
  299. { height: '80%', width: $container.width() } :
  300. { width: 'auto' };
  301. // stop any animation on container height / width
  302. $container.filter(':animated').stop();
  303. // disable transition, apply revised style
  304. $container.addClass('no-transition').css( style );
  305. setTimeout(function(){
  306. $container.removeClass('no-transition').isotope( options );
  307. }, 100 )
  308. } else {
  309. $container.isotope( options );
  310. }
  311. }
  312. // change size of clicked element
  313. $container.delegate( '.element', 'click', function(){
  314. $(this).toggleClass('large');
  315. $container.isotope('reLayout');
  316. });
  317. // toggle variable sizes of all elements
  318. $('#toggle-sizes').find('a').click(function(){
  319. $container
  320. .toggleClass('variable-sizes')
  321. .isotope('reLayout');
  322. return false;
  323. });
  324. $('#insert a').click(function(){
  325. var $newEls = $( fakeElement.getGroup() );
  326. $container.isotope( 'insert', $newEls );
  327. return false;
  328. });
  329. $('#append a').click(function(){
  330. var $newEls = $( fakeElement.getGroup() );
  331. $container.append( $newEls ).isotope( 'appended', $newEls );
  332. return false;
  333. });
  334. var $sortBy = $('#sort-by');
  335. $('#shuffle a').click(function(){
  336. $container.isotope('shuffle');
  337. $sortBy.find('.selected').removeClass('selected');
  338. $sortBy.find('[data-option-value="random"]').addClass('selected');
  339. return false;
  340. });
  341. });
  342. </script>
  343. <footer>
  344. Isotope by <a href="http://desandro.com">David DeSandro</a> / <a href="http://metafizzy.co">Metafizzy</a>
  345. </footer>
  346. </section> <!-- #content -->
  347. </body>
  348. </html>