PDA

View Full Version : Spry Menu Bar doesn't adjust to window size


erru9107
05-23-2016, 04:27 PM
I'm using a spry menu bar on my website and if my browser window is in full size mode, it looks great and everything. But if I place my browser window to the left side of my screen (by simply dragging the window there), the menu bar doesn't adjust it's size to the new dimensions of the browser window so it breaks the right side border of the container.

I first though it might be since I was using a liquid template, so I changed it to a fixed one, did nothing to help the issue.
I also tried adjusting the size of it by using % instead of em, didn't work either.

I'm now stuck and have no idea how to solve this issue. If anyone has any suggestions, I would be glad to try it! I'm planning on publishing the site sometime by the end of this week and this is basically the only designflaw left that I don't know how to fix.

Thanks in advance!

edbr
05-24-2016, 02:21 AM
do you have a link so we can see?

erru9107
05-24-2016, 12:25 PM
unfortunately not, I haven't published the site yet :/ but here's a couple of pictures to illustrate the issue.

Picture 1: How it looks with browser window in full size mode
Picture 2: How it looks after making the browser window smaller

edbr
05-25-2016, 02:20 AM
dcant tell much from pics, i get the problem but without the code is hard.
i would guessthough , that the nav bar and the menu itself , a UL i assume are not position:relative

erru9107
06-05-2016, 04:02 PM
I tried changing it to relative but it did nothing. I can give you the code here:


@charset "UTF-8";

/* SpryMenuBarHorizontal.css - version 0.6 - Spry Pre-Release 1.6.1 */

/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */

/************************************************** *****************************

LAYOUT INFORMATION: describes box model, positioning, z-order

************************************************** *****************************/

/* The outermost container of the Menu Bar, an auto width box with no margin or padding */
ul.MenuBarHorizontal
{
list-style-type: none;
font-size: 100%;
cursor: default;
width: 50em;
margin-top: 0;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
padding: 0;
}
/* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
ul.MenuBarActive
{
z-index: 1000;
}
/* Menu item containers, position children relative to this container and are a fixed width */
ul.MenuBarHorizontal li
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
position: relative;
text-align: left;
cursor: pointer;
width: 10em;
float: left;
}
/* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
ul.MenuBarHorizontal ul
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
z-index: 1020;
cursor: default;
width: 9.95em;
position: absolute;
left: -1000em;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
{
left: auto;
}
/* Menu item containers are same fixed width as parent */
ul.MenuBarHorizontal ul li
{
width: 9.95em;
}
/* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
ul.MenuBarHorizontal ul ul
{
position: absolute;
margin: -5% 0 0 95%;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
{
left: auto;
top: 0;
}

/************************************************** *****************************

DESIGN INFORMATION: describes color scheme, borders, fonts

************************************************** *****************************/

/* Submenu containers have borders on all sides */
ul.MenuBarHorizontal ul
{
border: 1px solid #CCC;
}
/* Menu items are a light gray block with padding and no text decoration */
ul.MenuBarHorizontal a
{
display: block;
cursor: pointer;
background-color: #daec93;
padding: 0.5em 0.75em;
color: #333;
text-decoration: none;
}
/* Menu items that have mouse over or focus have a blue background and white text */
ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
{
background-color: #33C;
color: #FFF;
}
/* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
{
background-color: #C9E35E;
color: #FFF;
}

/************************************************** *****************************

SUBMENU INDICATION: styles if there is a submenu under a given menu item

************************************************** *****************************/

/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal a.MenuBarItemSubmenu
{
background-image: url(SpryMenuBarDown.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
{
background-image: url(SpryMenuBarRight.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
{
background-image: url(SpryMenuBarDownHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
{
background-image: url(SpryMenuBarRightHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}

/************************************************** *****************************

BROWSER HACKS: the hacks below should not be changed unless you are an expert

************************************************** *****************************/

/* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
ul.MenuBarHorizontal iframe
{
position: absolute;
z-index: 1010;
filter:alpha(opacity:0.1);
}
/* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
@media screen, projection
{
ul.MenuBarHorizontal li.MenuBarItemIE
{
display: inline;
f\loat: left;
background: #FFF;
}
}

edbr
06-07-2016, 02:18 AM
is that in a containing tag and if so iis that relative?

erru9107
06-07-2016, 06:00 PM
Not sure I really understand the question, but this css is linked to the sites template. From what I can tell, that's the code that does basically everything when it comes to design of the menu bar.

edbr
06-08-2016, 05:49 AM
sorry i had a typo, can you post the code for the page?

erru9107
06-09-2016, 12:26 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nature Prods</title>
<link href="../oneColFixCtrHdr.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-repeat: repeat;
width: 85%;
margin-right: auto;
margin-left: auto;
}
</style>
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
a:link {
color: #0000FF;
}
a:visited {
color: #FF0000;
}
</style>
<!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */
ul.nav a { zoom: 1; } /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */
</style>
<![endif]-->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
</head>

<body background="../Bilder/Background.jpg">

<div class="container">
<div class="header"><a href="../sv/svenska.html"><img src="../Bilder/Header.jpg" alt="Insert Logo Here" name="Insert_logo" width="100%" height="153" id="Insert_logo" style="background-color: #8090AB; display:block;" /></a>
<!-- end .header --></div>
<p align="right">
<p align="right">Välj språk
<p>
<ul id="MenuBar1" class="MenuBarHorizontal">
<li>
<div align="center"><a class="MenuBarItemSubmenu" href="hem.html">Hem</a>
<ul>
<li><a href="svenska.html">Startsida</a></li>
<li><a href="omoss.html">Om Oss</a></li>
<li><a href="kontaktaoss.html">Kontakta Oss</a></li>
</ul>
</div>
</li>
<li>
<div align="center"><a class="MenuBarItemSubmenu" href="amnen.html">Ämnen</a>
<ul>
<li><a href="amnenalkohol.html">Alkoholer</a></li>
<li><a href="amnenmineral.html">Mineraloljor</a></li>
<li><a href="amnensilikon.html">Silikoner</a></li>
<li><a href="amnensulfat.html">Sulfater</a></li>
</ul>
</div>
</li>
<li>
<div align="center"><a class="MenuBarItemSubmenu" href="harvard.html">Hårvård</a>
<ul>
<li><a href="harvardbalsam.html">Balsammetoden</a></li>
<li><a href="harvardbikarbonat.html">Bikarbonat</a></li>
<li><a href="harvardbjork.html">Björklöv</a></li>
<li><a href="harvardsls.html">SLS-Fritt</a></li>
<li><a href="harvardvatten.html">Vattenmetoden</a></li>
<li><a href="harvardagg.html">Äggtvätt</a></li>
</ul>
</div>
</li>
<li>
<div align="center"><a class="MenuBarItemSubmenu" href="hudvard.html">Hudvård</a>
<ul>
<li><a href="hudvardbalsam.html">Balsammetoden</a></li>
<li><a href="hudvardsls.html">SLS-Fritt</a></li>
<li><a href="hudvardvatten.html">Vattenmetoden</a></li>
</ul>
</div>
</li>
<li>
<div align="center"><a class="MenuBarItemSubmenu" href="varaprodukter.html">Våra Produkter</a>
<ul>
<li><a href="varaprodukteralla.html">Alla Produkter</a></li>
<li><a href="varaprodukterhar.html">Hårprodukter</a></li>
<li><a href="varaprodukterhud.html">Hudprodukter</a></li>
<li><a href="varaprodukterbestall.html">Beställ</a></li>
</ul>
</div>
</li>
</ul>
<br />
<p>
<div class="content"><!-- TemplateBeginEditable name="Content" -->
<p>&nbsp;</p>
<p>Innehåll</p>
<!-- TemplateEndEditable --></div>
<div class="footer">
<p align="left"><a target="blank" href="https://www.facebook.com/Nature-Prods-856486491147043/"><img src="../Bilder/facebook.jpg" alt="" width="40" height="40" align="absmiddle" /></a> Gilla oss på Facebook<p>
Copyright &copy; Nature Prods 2016</p>
<h6>Den här sidan finansieras till viss del av reklam <a href="../PTC/ptc.html">här</a></h6>
<!-- end .footer --></div>
<!-- end .container --></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>

edbr
06-09-2016, 04:24 AM
ok there a couple of issues beside your ul problems.

you have several <p> tags that dont close so lose them
you insert the menu in <div align....> clear them also 9if you want text centered just change the css for the menu class.

I think though, you should look at a different layout. not the design , i mean use a responsive design and these problems re the meny would dissapear. so much searching is done on phones and tablets you cant ignore them and frankly its better to spend time now.
if you look for some templates you will see better menu options than spry which is a bit of a dead duck to be honest.
i will look for a suitable template later , and if Domedia isnt around to upload it ill find a link or upload somewhere

erru9107
06-09-2016, 08:40 PM
Yeah, I've been thinking about changing the menu bar. Unfortunately it's not up to me since I'm creating the website for my girlfriend and she's very specific with how she wants the site to look.

Maybe you know of any other menu that would look like the one I already have but work better? I can't find any that she's happy enough with :/

edbr
06-10-2016, 02:23 AM
we know our place right? :)
well from the images it looks like a drop down which can easily be done using just css or if you want animated drop downs use jquery. there are lots of free examples , styling to look like you have is just achieved with css syles,
ie.
http://cssmenumaker.com/css-drop-down-menu for css

and on the same site for jquery
http://cssmenumaker.com/menu/animated-responsive-drop-down-menu

but a search will show more.

edbr
06-10-2016, 02:24 AM
ah just realised that might be a pay for site (not free. but there are many that are

edbr
06-10-2016, 02:25 AM
do you have sub menus or 2 sub menus?

edbr
06-10-2016, 03:30 AM
here try this (not responsive though.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>

<style>
#nav
{ width: 1200px;
position:relative;
display:inline-block;
background:#FFFF99;}

#nav ul
{ width: 800px;
list-style:none;
position:relative;
margin-left:auto; margin-right:auto;
padding:0;
}

#nav ul a
{
display:block;
color:#333;
text-decoration:none;
font-weight:700;
font-size:12px;
line-height:32px;
padding:0 15px;
font-family:"HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif
}

#nav ul li
{ background:#DAEC93;
position:relative;
float:left;
margin:0;
padding:0
}

#nav ul li.current-menu-item
{
background:#ddd
}

#nav ul li:hover
{
background:#f6f6f6
}

#nav ul ul
{
display:none;
position:absolute;
top:100%;
left:0;
background:#fff;
padding:0
}

#nav ul ul li
{
float:none;
width:200px
}

#nav ul ul a
{
line-height:120%;
padding:10px 15px
}

#nav ul ul ul
{
top:0;
left:100%
}

#nav ul li:hover > ul
{
display:block
}


</style>
</head>

<body>

<nav id="nav">
<ul>
<li class="current-menu-item"><a href="#">Home</a></li>
<li><a href="#">Menu 1</a>
<ul>
<li><a href="#">Sub Menu 1</a></li>
<li><a href="#">Sub Menu 2</a></li>
<li><a href="#">Sub Menu 3</a></li>
<li><a href="#">Sub Menu 4</a>
<ul>
<li><a href="#">Deep Menu 1</a>
<ul>
<li><a href="#">sub sub 1</a></li>
<li><a href="#">sub sub 2</a></li>
<li><a href="#">sub sub 3</a></li>
<li><a href="#">sub sub 4</a></li>
</ul>
</li>
<li><a href="#">Deep Menu 2</a></li>
</ul>
</li>
<li><a href="#">Sub Menu 5</a></li>
</ul>
</li>
<li><a href="#">Menu 2</a>
<ul>
<li><a href="#">Sub Menu 1</a></li>
<li><a href="#">Sub Menu 2</a></li>
<li><a href="#">Sub Menu 3</a></li>
</ul>
</li>
<li><a href="#">Menu 3</a>
<ul>
<li class="dir"><a href="#">Sub Menu 1</a></li>
<li class="dir"><a href="#">Sub Menu 2 </a>
<ul>
<li><a href="#">Category 1</a></li>
<li><a href="#">Category 2</a></li>
<li><a href="#">Category 3</a></li>
<li><a href="#">Category 4</a></li>
<li><a href="#">Category 5</a></li>
</ul>
</li>
<li><a href="#">Sub Menu 3</a></li>
<li><a href="#">Sub Menu 4</a></li>
<li><a href="#">Sub Menu 5</a></li>
</ul>
</li>
<li><a href="#">Menu 4</a></li>
<li><a href="#">Menu 5</a></li>
<li><a href="#">Menu 6</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav>
</body>
</html>

erru9107
06-11-2016, 10:36 PM
I've got only one level sub menu.

I'll try your code tomorrow and see how it looks! But just by looking through it, it seems like it should work fine. Will get back to you after I've tried it!

Thanks for all your help, I really appreciate it! :) Helps to keep me out of trouble with the misses ;)

erru9107
06-13-2016, 11:16 AM
I just tried it out and it seems to work! Only done some minor testing tho so if I run into any more issues, I'll just make another post here.

In the meantime, thank you very much! :)