Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Having A Problem With An Expanding Menu

Featured Replies

Hey guys, I am new here and I think I will enjoy my stay here.

I am new the webdesigning and I know my designing skills suck badly but this is the best so far...

 

My problem is that the expanding menu (javascript) creates a new part, so as you can see there is a big gap at the menu. I have tried to fix this with no progress. I would love if you could help me with this. I can PM what you need if you want to help me with this...

 

And don't mind the green background, I just have that so I can see my divs, since the background is supposed to be black when it is done.

blacknwhite.bmp

Hey guys, I am new here and I think I will enjoy my stay here.

I am new the webdesigning and I know my designing skills suck badly but this is the best so far...

 

My problem is that the expanding menu (javascript) creates a new part, so as you can see there is a big gap at the menu. I have tried to fix this with no progress. I would love if you could help me with this. I can PM what you need if you want to help me with this...

 

And don't mind the green background, I just have that so I can see my divs, since the background is supposed to be black when it is done.

 

It will be better if you provide your code here.

Then it will be easier for us to give you some suggessions.

But not in PMs please make it open so that everyone can look at your issue and suggest their openions..

  • Author
<html>

<head>

<title>Sebastian's Portfolio 'Where are comes to life'</title>

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

<script type="text/javascript" src="expandingMenu.js"></script>

 

</head>

<body>

<div class="header">

</div>

<div class="menuTop"></div>

<div class="menuMain">

 

<ul id="menu">

<li></a href="index.html">Homepage</a></li>

<li>Portfolio

<ol>

<li><a href="photoshop.html">Photoshop</a></li>

<li><a href="illustrator.html">Illustrator</a></li>

<li><a href="flash.html">Flash</a></li>

</ol>

</li>

<li><a href="about.html">About me</a></li>

<li><a href="contact.html">Contact</a></li>

</ul>

</p>

 

</div>

<div class="menuBottom"></div>

 

<div class="main" align="center" valign="middle">

<iframe src="startpage.html" name="iframe" width="601" height="426" marginwidth="10" marginheight="7" scrolling="auto" allowtransparency="true" frameborder="0" style="position:absolute; left:15px; top:16">

 

</iframe>

</div>

<div class="footer">

</div>

</body>

</html>

 

body{

background-color:#00ff00;

}

.header{

position:absolute;

left:134px;

background-image: url(header.png);

width:628px;

height:61px;

}

.menuTop{

background-image: url(menuEmptyTop.png);

width:126px;

height:127;

}

.menuMain{

background-image: url(menuEmptyMain.png);

width:126px;

}

.menuBottom{

 

background-image: url(menuEmptyBottom.png);

width:126px;

height:248px;

}

.main{

position:absolute;

top:69px;

left:134px;

background-image: url(main.png);

width:628px;

height:456px;

}

.footer{

position:absolute;

top:525px;

left:134px;

background-image: url(footer.png);

width:628px;

height:37px;

}

#menuRow{

position:absolute;

}

p{

font-family: verdana;

color: #ffffff;

}

#menu{

position:absoulute;

top:100px;

}

ul#menu {

width: 130px;

list-style-type: none;

margin:;

padding: 0;

font-size: 1.2em;

font-family:Verdana;

}

 

ul#menu ol {

display: none;

text-align: left;

font-size: 0.8em;

list-style-type: none;

margin: 0;

padding: 5px;

font-family:Verdana;

}

 

ul#menu li,

ul#menu a {

color: #ffffff;

 

}

 

ul#menu li {

line-height: 20px;

 

}

 

ul#menu ol li {

border-bottom: none;

 

}

 

ul#menu ol li:before {

content: "- ";

 

}

 

ul#menu a {

text-decoration: none;

outline: none;

}

 

ul#menu a:hover {

color: #ffffff;

 

}

 

ul#menu a.active {

color: #ffffff;

}

 

/* This script and many more are available free online at

The JavaScript Source :: http://javascript.internet.com

Created by: Travis Beckham :: http://www.squidfingers.com | http://www.podlob.com

version date: 06/02/03 :: If want to use this code, feel free to do so,

but please leave this message intact. (Travis Beckham) */

 

// Node Functions

 

if(!window.Node){

var Node = {ELEMENT_NODE : 1, TEXT_NODE : 3};

}

 

function checkNode(node, filter){

return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase());

}

 

function getChildren(node, filter){

var result = new Array();

var children = node.childNodes;

for(var i = 0; i < children.length; i++){

if(checkNode(children, filter)) result[result.length] = children;

}

return result;

}

 

function getChildrenByElement(node){

return getChildren(node, "ELEMENT_NODE");

}

 

function getFirstChild(node, filter){

var child;

var children = node.childNodes;

for(var i = 0; i < children.length; i++){

child = children;

if(checkNode(child, filter)) return child;

}

return null;

}

 

function getFirstChildByText(node){

return getFirstChild(node, "TEXT_NODE");

}

 

function getNextSibling(node, filter){

for(var sibling = node.nextSibling; sibling != null; sibling = sibling.nextSibling){

if(checkNode(sibling, filter)) return sibling;

}

return null;

}

function getNextSiblingByElement(node){

return getNextSibling(node, "ELEMENT_NODE");

}

 

// Menu Functions & Properties

 

var activeMenu = null;

 

function showMenu() {

if(activeMenu){

activeMenu.className = "";

getNextSiblingByElement(activeMenu).style.display = "none";

}

if(this == activeMenu){

activeMenu = null;

} else {

this.className = "active";

getNextSiblingByElement(this).style.display = "block";

activeMenu = this;

}

return false;

}

 

function initMenu(){

var menus, menu, text, a, i;

menus = getChildrenByElement(document.getElementById("menu"));

for(i = 0; i < menus.length; i++){

menu = menus;

text = getFirstChildByText(menu);

a = document.createElement("a");

menu.replaceChild(a, text);

a.appendChild(text);

a.href = "#";

a.onclick = showMenu;

a.onfocus = function(){this.blur()};

}

}

 

if(document.createElement) window.onload = initMenu;

 

I hope this will help...

Is it the green sections above HOME PAGE and below CONTACT that you are trying to get rid of?

 

If so, you may try positioning the menu itself inside a div layer. You can then give the div layer a background style to mimic the green for example.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.