climatecontrol.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. $(document).ready( function() {
  2. $('nav#primary-navigation .nav-menu > li').hover( function() {
  3. if ( $(this).has('.sub-menu').length ) {
  4. $('.sub-nav-back').addClass('show');
  5. }
  6. },
  7. function() {
  8. $('.sub-nav-back').removeClass('show');
  9. });
  10. });
  11. $(window).load( function() {
  12. $('#slider').nivoSlider({
  13. directionNav: false,
  14. controlNav: false,
  15. });
  16. });
  17. $(function () {
  18. $("#menu-primary-menu").tinyNav(
  19. {
  20. active: 'selected', // String: Set the "active" class
  21. header: 'Navigation', // String: Specify text for "header" and show header instead of the active item
  22. indent: '- ', // String: Specify text for indenting sub-items
  23. label: '' // String: Sets the <label> text for the <select> (if not set, no label will be added)
  24. }
  25. );
  26. });
  27. /*! http://tinynav.viljamis.com v1.2 by @viljamis */
  28. (function ($, window, i) {
  29. $.fn.tinyNav = function (options) {
  30. // Default settings
  31. var settings = $.extend({
  32. 'active' : 'selected', // String: Set the "active" class
  33. 'header' : '', // String: Specify text for "header" and show header instead of the active item
  34. 'indent' : '- ', // String: Specify text for indenting sub-items
  35. 'label' : '' // String: sets the <label> text for the <select> (if not set, no label will be added)
  36. }, options);
  37. return this.each(function () {
  38. // Used for namespacing
  39. i++;
  40. var $nav = $(this),
  41. // Namespacing
  42. namespace = 'tinynav',
  43. namespace_i = namespace + i,
  44. l_namespace_i = '.l_' + namespace_i,
  45. $select = $('<select/>').attr("id", namespace_i).addClass(namespace + ' ' + namespace_i);
  46. if ($nav.is('ul,ol')) {
  47. if (settings.header !== '') {
  48. $select.append(
  49. $('<option/>').text(settings.header)
  50. );
  51. }
  52. // Build options
  53. var options = '';
  54. $nav
  55. .addClass('l_' + namespace_i)
  56. .find('a')
  57. .each(function () {
  58. options += '<option value="' + $(this).attr('href') + '">';
  59. var j;
  60. for (j = 0; j < $(this).parents('ul, ol').length - 1; j++) {
  61. options += settings.indent;
  62. }
  63. options += $(this).text() + '</option>';
  64. });
  65. // Append options into a select
  66. $select.append(options);
  67. // Select the active item
  68. if (!settings.header) {
  69. $select
  70. .find(':eq(' + $(l_namespace_i + ' li')
  71. .index($(l_namespace_i + ' li.' + settings.active)) + ')')
  72. .attr('selected', true);
  73. }
  74. // Change window location
  75. $select.change(function () {
  76. window.location.href = $(this).val();
  77. });
  78. // Inject select
  79. $(l_namespace_i).after($select);
  80. // Inject label
  81. if (settings.label) {
  82. $select.before(
  83. $("<label/>")
  84. .attr("for", namespace_i)
  85. .addClass(namespace + '_label ' + namespace_i + '_label')
  86. .append(settings.label)
  87. );
  88. }
  89. }
  90. });
  91. };
  92. })(jQuery, this, 0);