css-js.html 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <p>The main advantage of using Skinr is that it provides a means of easily
  2. reusing CSS classes. How you set up those classes and the code you provide
  3. is up to you. This page is meant to inform you about your options.
  4. </p>
  5. <h3 id="css-js-classes">CSS classes in Skins</h3>
  6. <p>Classes in Skinr are typically defined in the <a
  7. href="topic:skinr/syntax#syntax-options">skin options</a>. A single class is
  8. all that is necessary, but multiple classes can easily be added.
  9. </p>
  10. <h4 id="css-js-classes-single">Single Class</h4>
  11. <pre>skinr[skin_system_name][options][1][class] = foo-class</pre>
  12. <h4 id="css-js-classes-multiple">Multiple Classses</h4>
  13. <p>Multiple classes should be separated by a single space.</p>
  14. <pre>skinr[skin_system_name][options][1][class] = foo-class bar-class</pre>
  15. <h3 id="css-js-external">External CSS &amp; JavaScript files</h3>
  16. <p>CSS can be stored in external files, or the files can simply be added to
  17. your theme's existing CSS file. Personally, I like to create a separate CSS
  18. file that stores the bulk of Skinr CSS. The same can be done with JavaScript
  19. files. If your skins require CSS &amp; Javascript that is used site wide, the
  20. best approach is to load the files normally via the theme. This will ensure
  21. your files are loaded on all pages and therefore always available.</p>
  22. <pre>
  23. stylesheets[all][] = css/skinr.css
  24. scripts[] = js/skinr.js
  25. </pre>
  26. <h4>Adding files to skins</h4>
  27. <p>There are cases where it makes sense to handle loading the CSS/JavaScript
  28. files in the skin itself. This can be done by by adding the following line(s)
  29. to your skin.
  30. </p>
  31. <pre>
  32. skinr[skin_system_name][scripts][] = css/dropdown.js
  33. skinr[skin_system_name][stylesheets][all][] = css/dropdown.css
  34. </pre>
  35. <h4>Adding files to skin options</h4>
  36. <p>This can be taken a step further by including files per option. Below is a
  37. detailed example of what a use case for this might look like:</p>
  38. <pre>
  39. skinr[dropdowns][title] = Dropdown Menus
  40. skinr[dropdowns][type] = select
  41. skinr[dropdowns][description] = Select a vertical or horizontal dropdown menu.
  42. skinr[dropdowns][features][] = block_menu_block
  43. skinr[dropdowns][stylesheets][all][] = css/dropdown.css
  44. skinr[dropdowns][scripts][] = js/hoverIntent.js
  45. skinr[dropdowns][options][1][label] = Horizontal
  46. skinr[dropdowns][options][1][class] = dd-vertical
  47. skinr[dropdowns][options][1][stylesheets][all][] = css/dropdown-vertical.css
  48. skinr[dropdowns][options][1][scripts][] = js/dropdown-vertical.js
  49. skinr[dropdowns][options][2][label] = Vertical
  50. skinr[dropdowns][options][2][class] = dd-horizontal
  51. skinr[dropdowns][options][2][stylesheets][all][] = css/dropdown-horizontal.css
  52. skinr[dropdowns][options][2][scripts][] = js/dropdown-horizontal.js
  53. </pre>
  54. <p>The syntax for adding these files is the same as Drupal. See <a
  55. href="http://drupal.org/node/171205">Structure of the .info file</a> for full
  56. details.</p>
  57. <h3 id="css-js-ui-classes">Defining classes in the UI</h3>
  58. <p>In addition to defining CSS classes in the .info file, you can also add
  59. classes directly into the UI. Under "Advanced Options" there is a text field
  60. where you can add a class or classes manually. The syntax for adding classes
  61. the same as the <a href="#css-js-classes">above examples</a>, with multiple classes separated by a space.
  62. </p>
  63. <p><img src="&path&images/ui-e.png" alt="Adding classes in the UI" /></p>