climatecontrol.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. /*! http://tinynav.viljamis.com v1.2 by @viljamis */
  21. (function ($, window, i) {
  22. $.fn.tinyNav = function (options) {
  23. // Default settings
  24. var settings = $.extend({
  25. 'active' : 'selected', // String: Set the "active" class
  26. 'header' : '', // String: Specify text for "header" and show header instead of the active item
  27. 'indent' : '- ', // String: Specify text for indenting sub-items
  28. 'label' : '' // String: sets the <label> text for the <select> (if not set, no label will be added)
  29. }, options);
  30. return this.each(function () {
  31. // Used for namespacing
  32. i++;
  33. var $nav = $(this),
  34. // Namespacing
  35. namespace = 'tinynav',
  36. namespace_i = namespace + i,
  37. l_namespace_i = '.l_' + namespace_i,
  38. $select = $('<select/>').attr("id", namespace_i).addClass(namespace + ' ' + namespace_i);
  39. if ($nav.is('ul,ol')) {
  40. if (settings.header !== '') {
  41. $select.append(
  42. $('<option/>').text(settings.header)
  43. );
  44. }
  45. // Build options
  46. var options = '';
  47. $nav
  48. .addClass('l_' + namespace_i)
  49. .find('a')
  50. .each(function () {
  51. options += '<option value="' + $(this).attr('href') + '">';
  52. var j;
  53. for (j = 0; j < $(this).parents('ul, ol').length - 1; j++) {
  54. options += settings.indent;
  55. }
  56. options += $(this).text() + '</option>';
  57. });
  58. // Append options into a select
  59. $select.append(options);
  60. // Select the active item
  61. if (!settings.header) {
  62. $select
  63. .find(':eq(' + $(l_namespace_i + ' li')
  64. .index($(l_namespace_i + ' li.' + settings.active)) + ')')
  65. .attr('selected', true);
  66. }
  67. // Change window location
  68. $select.change(function () {
  69. window.location.href = $(this).val();
  70. });
  71. // Inject select
  72. $(l_namespace_i).after($select);
  73. // Inject label
  74. if (settings.label) {
  75. $select.before(
  76. $("<label/>")
  77. .attr("for", namespace_i)
  78. .addClass(namespace + '_label ' + namespace_i + '_label')
  79. .append(settings.label)
  80. );
  81. }
  82. }
  83. });
  84. };
  85. })(jQuery, this, 0);