Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. var $previous_hover, $previous_scheme = null;
  2.  
  3. $('input:checkbox').change(function(){
  4. var $this = $(this);
  5. var $album = $('.album');
  6. var $caption = $('.thumb-caption');
  7. var $currentHov = $this.data('hover');
  8. var $currentSch = $this.data('scheme');
  9.  
  10. // Only remove the class in the specific `box` that contains the radio
  11. $this.closest('.selection').find('li.active').removeClass('active');
  12. // $this.prop('checked', false);
  13. $this.closest('.option').addClass('active');
  14.  
  15.  
  16. if ($this.closest('.selection input:checkbox').is(':checked')) {
  17. $album.addClass($currentHov);
  18. } else if ($this.closest('#hover-nav.selection').not(':checked')){
  19. $album.removeClass($previous_hover);
  20. }
  21. if ($this.closest('.selection input:checkbox').is(':checked')){
  22. $caption.addClass($currentSch);
  23. } else if ($this.closest('.selection input:checkbox').not(':checked')){
  24. $caption.removeClass($previous_scheme);
  25. }
  26.  
  27. $previous_hover = $currentHov;
  28. $previous_scheme = $currentSch;
  29.  
  30. if ($album.hasClass('hover05')) {
  31. $caption.children().hide();
  32. $caption.append('<span class="magnify"></span>');
  33. } else {
  34. $('.magnify').remove();
  35. $caption.children().show();
  36. }
  37. });
  38.  
  39. <div id="settings-panel">
  40. <form id="settings-inner" name="settingsform">
  41. <span id="settings-icon"></span>
  42. <ul id="color-picker" class="selection">
  43. <li id="scheme01" class="option active">
  44. <label>
  45. <div class="color1">
  46. <input class="hide" type="checkbox" name="scheme" value="scheme01" data-scheme="default" />
  47. </div>
  48. <span>Scheme 1</span>
  49. </label>
  50. </li>
  51. <li id="scheme02" class="option">
  52. <label>
  53. <div class="color2">
  54. <input class="hide" type="checkbox" name="scheme" value="scheme02" data-scheme="scheme02" />
  55. </div>
  56. <span>Scheme 2</span>
  57. </label>
  58. </li>
  59. <!-- <li id="scheme03"><span class="color3"></span><span>scheme 3</span></li>
  60. <li id="scheme04"><span class="color4"></span><span>scheme 4</span></li>
  61. <li id="scheme05"><span class="color5"></span><span>scheme 5</span></li>
  62. <li id="scheme06"><span class="color6"></span><span>scheme 6</span></li> -->
  63. </ul>
  64. <ul id="hover-nav" class="selection cf">
  65. <li class="option active">
  66. <label>
  67. <input class="hide" type="checkbox" name="hover" value="nohover" data-hover="nohover" />
  68. No Hover
  69. </label>
  70. </li>
  71. <li class="option">
  72. <label>
  73. <input class="hide" type="checkbox" name="hover" value="hover01" data-hover="hover01" />
  74. Hover Style 01
  75. </label>
  76. </li>
  77. <li class="option">
  78. <label>
  79. <input class="hide" type="checkbox" name="hover" value="hover02" data-hover="hover02" />
  80. Hover Style 02
  81. </label>
  82. </li>
  83. <li class="option">
  84. <label>
  85. <input class="hide" type="checkbox" name="hover" value="hover03" data-hover="hover03" />
  86. Hover Style 03
  87. </label>
  88. </li>
  89. <li class="option">
  90. <label>
  91. <input class="hide" type="checkbox" name="hover" value="hover04" data-hover="hover04" />
  92. Hover Style 04
  93. </label>
  94. </li>
  95. <li class="option">
  96. <label>
  97. <input class="hide" type="checkbox" name="hover" value="hover055" data-hover="hover05" />
  98. Hover Style 05
  99. </label>
  100. </li>
  101. </ul>
  102. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement