Shorten function, please
Shorten function, please
Help please to Shorten function, please:
Function 1:
- jQuery(function($) { // Shorthand for jQuery(document).ready(function($) {
- init1('#buttonOne', 0);
- function init(selector, count) { //add indicator and hovers to submenu parents
- $(selector).find('li').each(function() {
- if ($(this).find('ul').length > count) {
-
- $(this).hover(function() { // show subnav on hover
- $('ul li:first', this).load('pageOne.html');
- $(this).find('ul').stop(true, true).slideDown();
- }, function() { // hide submenus on exit
- $(this).find('ul').stop(true, true).slideUp();
- });
- }
- });
- }
- });
Function 2:
- jQuery(function($) { // Shorthand for jQuery(document).ready(function($) {
- init2('#buttonTwo', 0);
- function init(selector, count) { //add indicator and hovers to submenu parents
- $(selector).find('li').each(function() {
- if ($(this).find('ul').length > count) {
-
- $(this).hover(function() { // show subnav on hover
- $('ul li:first', this).load('pageTwo.html');
- $(this).find('ul').stop(true, true).slideDown();
- }, function() { // hide submenus on exit
- $(this).find('ul').stop(true, true).slideUp();
- });
- }
- });
- }
- });
Function 3:
- jQuery(function($) { // Shorthand for jQuery(document).ready(function($) {
- init3('#buttonThree', 0);
- function init(selector, count) { //add indicator and hovers to submenu parents
- $(selector).find('li').each(function() {
- if ($(this).find('ul').length > count) {
-
- $(this).hover(function() { // show subnav on hover
- $('ul li:first', this).load('pageThree.html');
- $(this).find('ul').stop(true, true).slideDown();
- }, function() { // hide submenus on exit
- $(this).find('ul').stop(true, true).slideUp();
- });
- }
- });
- }
- });
greetings friends-