Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Linking nested elements

New Here ,
Jun 16, 2017 Jun 16, 2017

Copy link to clipboard

Copied

I have made unordered list on my site. But I want to nest extra links that appear when I hover over.

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Bayside Beat: Cable Cars</title>

<link href="styles/responsive.css" rel="stylesheet" type="text/css">

<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--><script>var __adobewebfontsappname__="dreamweaver"</script><script src="http://use.edgefonts.net/source-sans-pro:n2,n4,n6:default.js" type="text/javascript"></script>

<meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<body>

<div id="wrapper">

  <header>

    <h1>IT in finance and commerce</h1>

    <nav>

      <h2 id="menulink"><a href="#navlinks">Menu</a></h2>

      <ul class="displayed" id="navlinks">

        <li><a href="index.html" class="thispage">Home</a></li>

        <li><a href="#">issues and problems</a></li>

        <li><a href="#">improvements and innovations</a></li>

        <li><a href="#">Bibliography</a></li>

      </ul>

    </nav>

  </header>

After that I added a .js file as follows:

/* Control sliding menu on screens smaller than a specified breakpoint */

(function(menu_button, links, breakpoint) {

'use strict';

var menulink = document.getElementById(menu_button),

   menu = document.getElementById(links);

menu.className = 'start';

setTimeout(function() {

menu.className = 'collapsed';

}, 20);

menulink.onclick = function() {

if (menu.className === 'displayed') {

menu.className = 'collapsed';

} else {

menu.className = 'displayed';

}

return false;

};

window.onresize = function() {

if (window.innerWidth < breakpoint) {

menu.className = 'collapsed';

}

};

})('menulink', 'navlinks', 700);

Now I'm stuck on how to add nested links. I want 3 under "issues and problems" and 2 under "improvments and innovations. I'm a beginner so bear with me i need help.

Views

448
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jun 16, 2017 Jun 16, 2017

If you're asking what I think you're asking, you simply insert another unordered list after the menu item requiring the additional two or three sub-links:

<ul class="displayed" id="navlinks">

     <li><a href="index.html" class="thispage">Home</a></li>

     <li><a href="#">issues and problems</a></li>

          <ul>

               <li><a href="#">issues and problems1</a></li>

               <li><a href="#">issues and problems2</a></li>

               <li><a href="#">issues and problems3</a></li>

       

...

Votes

Translate
Enthusiast ,
Jun 16, 2017 Jun 16, 2017

Copy link to clipboard

Copied

If you're asking what I think you're asking, you simply insert another unordered list after the menu item requiring the additional two or three sub-links:

<ul class="displayed" id="navlinks">

     <li><a href="index.html" class="thispage">Home</a></li>

     <li><a href="#">issues and problems</a></li>

          <ul>

               <li><a href="#">issues and problems1</a></li>

               <li><a href="#">issues and problems2</a></li>

               <li><a href="#">issues and problems3</a></li>

          </ul>

     <li>TEXT</li>

     <li><a href="#">improvements and innovations</a></li>

          <ul>

               <li><a href="#">improvements and innovations1</a></li>

               <li><a href="#">improvements and innovations2</a></li>

          </ul>

      <li><a href="#">Bibliography</a></li>

</ul>

Chris

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2017 Jun 16, 2017

Copy link to clipboard

Copied

To add to Chris' reply, hover does not work on a touch screen.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2017 Jun 16, 2017

Copy link to clipboard

Copied

LATEST

Your call to JavaScript code must be wrapped inside a pair of <script> tags.

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines