The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How do I add more links to the drop down menu without the button disappearing from the menu?

View previous topic View next topic Go down

Solved How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Diana on October 6th 2015, 11:29 pm

In refrence of this topic: http://help.forumotion.com/t143683-how-to-create-add-drop-down-menu
When I add more links to the menu, the button disappears from the menu. How do I add more links to the drop down menu without the button disappearing from the menu?

@Ange Tuteur


Last edited by rhe on October 8th 2015, 12:30 am; edited 1 time in total

Diana
Active Poster

Female Posts : 1286
Reputation : 21
Language : English

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Diana on October 7th 2015, 11:42 pm

anyone?

Diana
Active Poster

Female Posts : 1286
Reputation : 21
Language : English

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Ange Tuteur on October 8th 2015, 12:03 am

Hi @rhe,

Sorry for the late reply. To add more links, simply add a comma after the last pair, then write two sets of quotes separated by a colon. ( 'name' : 'url' )

For example, I have these links :
Code:
        subItems : {
          'HTML Page 1' : '/h1-',
          'HTML Page 2' : '/h2-',
          'HTML Page 3' : '/h3-',
          'HTML Page 4' : '/h4-'
        }

Then to add a new one, I'll add a comma after the last pair and create a new pair :
Code:
        subItems : {
          'HTML Page 1' : '/h1-',
          'HTML Page 2' : '/h2-',
          'HTML Page 3' : '/h3-',
          'HTML Page 4' : '/h4-',
          'New Link' : '/h5-'
        }

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Diana on October 8th 2015, 12:05 am

that's what I did but the button disappeared from the menu

Diana
Active Poster

Female Posts : 1286
Reputation : 21
Language : English

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Ange Tuteur on October 8th 2015, 12:14 am

Could you post the modified code here for me to look at ?

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Diana on October 8th 2015, 12:16 am

Code:
$(function() {
      var item = {
            name : '',
            subItems : {
              'VHH' : 'http://velvet.forum.co.ee/VHH-h10.htm',
              'Vastukaja' : 'http://velvet.forum.co.ee/Vastukaja-h5.htm',
              'Nädalaküsitlus' : 'http://velvet.forum.co.ee/Nadalakusitlus-h8.htm',
              'Tänased aktiivsed teemad' : 'http://velvet.forum.co.ee/search?search_id=activetopics'
'Vastamata teemad' : 'http://velvet.forum.co.ee/search?search_id=unanswered'
'Vaata enda postitusi' : 'http://velvet.forum.co.ee/search?search_id=egosearch'
'Tänased Top 20 postitajat : 'http://velvet.forum.co.ee/memberlist?mode=today_posters'
              'Lemmikud teemad' : 'http://velvet.forum.co.ee/search?search_id=favouritesearch',
              'Postitused peale eelmist külastust' : 'http://velvet.forum.co.ee/search?search_id=newposts',
              'Jälgitavad teemad' : 'http://velvet.forum.co.ee/search?search_id=watchsearch',
            }
          },
       
          link = document.createElement('A'),
          dropdown = document.createElement('DIV'),
          str = '', i,
          menu = document.querySelector ? document.querySelector('.bodyline > table + table') : $('.bodyline > table + table')[0];

      if (menu) {
        menu = menu.getElementsByTagName('TD')[0];

        dropdown.id = 'fa_menu_dd';
        dropdown.className = 'dd-hidden';
        for (i in item.subItems) str += '<a href="' + item.subItems[i] + '" class="dropdown-item">' + i + '</a>';
        dropdown.innerHTML = str;

        link.innerHTML = item.name;
        link.className = 'mainmenu';
    link.id = 'fa_dropdown_link';
        link.href = '#';
        link.onclick = function() {
          var menu = document.getElementById('fa_menu_dd'), offset = $(this).offset();
          if (menu) {
            if (/dd-hidden/.test(menu.className)) {
              menu.className = '';
              menu.style.left = offset.left + 'px';
              menu.style.top = offset.top + 'px';
            } else {
              menu.className = 'dd-hidden';
            }
          }
          return false;
        };

        menu.appendChild(link);
        menu.appendChild(dropdown);
      }
    });

Diana
Active Poster

Female Posts : 1286
Reputation : 21
Language : English

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Ange Tuteur on October 8th 2015, 12:24 am

Try this :
Code:
$(function() {
      var item = {
            name : '',
            subItems : {
              'VHH' : 'http://velvet.forum.co.ee/VHH-h10.htm',
              'Vastukaja' : 'http://velvet.forum.co.ee/Vastukaja-h5.htm',
              'Nädalaküsitlus' : 'http://velvet.forum.co.ee/Nadalakusitlus-h8.htm',
              'Tänased aktiivsed teemad' : 'http://velvet.forum.co.ee/search?search_id=activetopics',
              'Vastamata teemad' : 'http://velvet.forum.co.ee/search?search_id=unanswered',
              'Vaata enda postitusi' : 'http://velvet.forum.co.ee/search?search_id=egosearch',
              'Tänased Top 20 postitajat' : 'http://velvet.forum.co.ee/memberlist?mode=today_posters',
              'Lemmikud teemad' : 'http://velvet.forum.co.ee/search?search_id=favouritesearch',
              'Postitused peale eelmist külastust' : 'http://velvet.forum.co.ee/search?search_id=newposts',
              'Jälgitavad teemad' : 'http://velvet.forum.co.ee/search?search_id=watchsearch'
            }
          },
       
          link = document.createElement('A'),
          dropdown = document.createElement('DIV'),
          str = '', i,
          menu = document.querySelector ? document.querySelector('.bodyline > table + table') : $('.bodyline > table + table')[0];

      if (menu) {
        menu = menu.getElementsByTagName('TD')[0];

        dropdown.id = 'fa_menu_dd';
        dropdown.className = 'dd-hidden';
        for (i in item.subItems) str += '<a href="' + item.subItems[i] + '" class="dropdown-item">' + i + '</a>';
        dropdown.innerHTML = str;

        link.innerHTML = item.name;
        link.className = 'mainmenu';
    link.id = 'fa_dropdown_link';
        link.href = '#';
        link.onclick = function() {
          var menu = document.getElementById('fa_menu_dd'), offset = $(this).offset();
          if (menu) {
            if (/dd-hidden/.test(menu.className)) {
              menu.className = '';
              menu.style.left = offset.left + 'px';
              menu.style.top = offset.top + 'px';
            } else {
              menu.className = 'dd-hidden';
            }
          }
          return false;
        };

        menu.appendChild(link);
        menu.appendChild(dropdown);
      }
    });

There were some commas missing at the end of a few pairs, plus a broken string on one of the names.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by Diana on October 8th 2015, 12:29 am

thanks! The button in the menu is showing now Smile

Diana
Active Poster

Female Posts : 1286
Reputation : 21
Language : English

Back to top Go down

Solved Re: How do I add more links to the drop down menu without the button disappearing from the menu?

Post by brandon_g on October 8th 2015, 12:31 am

Topic solved and archived ~ brandon_g


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5140
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum