I've been searching for StackOverflow about my problem, but I didn't find the answer, my problem is, I have navbar menu on top of my website which if you open from mobile browser (chrome, UC browser, etc) its show the scroll bar and the menu can be scrolled if you touch the menu text (black circle) not the scroll bar (blue circle), my scrollbar can't be drag to scroll the menu, but it can be clicked to drag the menu, here is the picture of the menu
and my css is here
.classsname{
height: 300px;
overflow-y: scroll;
position:relative;
z-index: 0;
-webkit-overflow-scrolling:touch;
-webkit-transform:translateZ(0);}
what did I do wrong?
EDIT: my full css with header nav, and header nav
on my php
#media (max-width: 991px)
{
.mean-nav .header-nav{
height: 300px;
overflow-y: scroll;
position:relative;
z-index: 0;
-webkit-overflow-scrolling:touch;
-webkit-transform:translateZ(0);
}
}
and i called this css below with this
<ul id="menu-main-menu" class="header-nav clearfix">
<li class="menu-item <?= $isHome ? 'current-menu-item' : '' ?>"><a title="Home" href="<?= Url::home();?>">Home</a>
</li>
<li class="menu-item menu-item-has-children <?php
$a = Url::current();
if((Url::current() == Url::to(['site/about'])) or (strpos($a, 'event')))
echo 'current-menu-item';
?>"><a title="About">About</a>
<ul class="sub-menu">
<li class="menu-item"><a title="Vision and Mission" href="<?= Url::to(['site/about']) ?>">Vision and Mission</a></li>
<li class="menu-item"><a title="Event" href="<?= Url::to(['event/index', 'page'=>'1']) ?>">Event</a></li>
</ul>
</li>
.....
</ul>
and on my css
a.meanmenu-reveal{
overflow-y: scroll;
z-index: 1;
top:-50px !important;
}
.mean-container .mean-bar .mean-nav ul li a.mean-expand{
font-size: 24px;
line-height: 18px !important;
}
nav.main-menu{margin-top:0;}
Related
I have a horizontal navigation bar in the header of my website. I'm almost done styling it, but I can't work around 1 problem.
I have, I think about 1px, spacing below the menu. (see the small green line right under 'a blog page'. I discovered it is caused by the float:left that I use on the li-items. If I remove the float, I get an unwanted spacing on the right side of every menu item
There's no padding or margin around it and I don't see any other code that could, in my opinion, cause the problem.
HTML (shortened):
<nav id="main-nav" role="navigation" aria-label="Hoofdmenu">
<ul id="primary-menu" class="menu" role="menubar" style="">
<li id="menu-item-2129" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-703 current_page_item current_page_parent menu-item-2129">a Blog page</li>
<li id="menu-item-2100" class="menu-item menu-item-has-children menu-item-2100" aria-haspopup="true" aria-expanded="false" tabindex="0"><a>Template 2</a></li>
<li id="menu-item-2126" class="menu-item menu-item-has-children menu-item-2126" aria-haspopup="true" aria-expanded="false" tabindex="0"><a>Template 3</a></li>
</ul>
</nav>
CSS:
#main-nav {
width: 100%;
display:block;
}
#primary-menu {
display: block;
text-align: left;
margin: 0;
padding: 0;
}
li {
line-height: 50px;
opacity: 1;
list-style: 0;
display: inline-block;
position: relative;
float: left;
}
a {
padding: 0 20px;
display: block;
}
Do try
* {
margin: 0;
padding: 0;
}
at the top of your css. As hans-kong posted to eliminate any default browser stylesheets
HTML fixed footer with vertically scrolling content (standard stuff I hope, overflow:auto etc.).
When vertically scrolling through elements via right-swipe VoiceOver gesture as soon as VoiceOver focus hits the elements at the bottom of the visible view the VoiceOver focus moves through elements correctly but the scrollbar only scrolls half the element height hence the VoiceOver focus moves below the visible area.
EDIT Updated snippet, in previous one height of container was less that 50%, updated for clarity to show that the height doesn't matter.
Thanks in advance.
.scrollContainer {
position: absolute;
overflow: auto;
top: 0;
width: 100%;
bottom: 100px;
}
.rightData {
float: right;
padding-right: 10px;
}
.stepData {
padding: 0px;
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
}
.stepData > li {
height: 42px;
border-top: 1px solid black;
padding: 12px 20px;
font-size: 1.25em;
}
#footer {
position: absolute;
height: 100px;
width: 100%;
bottom: 0;
background-color: cyan;
}
<div style="height:500px;">
<div id="container" class="scrollContainer">
<ul class="stepData" style="padding:0px;">
<li role="button" aria-label="date">06/01<span class="rightData" aria-label="steps">1001</span></li>
<li role="button" aria-label="date">06/02<span class="rightData" aria-label="steps">1002</span></li>
<li role="button">06/03<span class="rightData">1003</span></li>
<li role="button">06/04<span class="rightData">1003</span></li>
<li role="button">06/05<span class="rightData">1005</span></li>
<li role="button">06/06<span class="rightData">1006</span></li>
<li role="button">06/07<span class="rightData">1007</span></li>
<li role="button">06/08<span class="rightData">1008</span></li>
<li role="button">06/09<span class="rightData">1009</span></li>
<li role="button">06/10<span class="rightData">1010</span></li>
<li role="button">06/11<span class="rightData">1011</span></li>
<li role="button">06/12<span class="rightData">1012</span></li>
<li role="button">06/13<span class="rightData">1013</span></li>
<li role="button">06/14<span class="rightData">1014</span></li>
<li role="button">06/15<span class="rightData">1015</span></li>
<li role="button">06/16<span class="rightData">1016</span></li>
<li role="button">06/17<span class="rightData">1017</span></li>
<li role="button">06/18<span class="rightData">1018</span></li>
<li role="button">06/19<span class="rightData">1019</span></li>
<li role="button">06/20<span class="rightData">1020</span></li>
<li role="button">06/21<span class="rightData">1021</span></li>
<li role="button">06/22<span class="rightData">1022</span></li>
<li role="button">06/23<span class="rightData">1023</span></li>
<li role="button">06/24<span class="rightData">1023</span></li>
<li role="button">06/25<span class="rightData">1025</span></li>
<li role="button">06/26<span class="rightData">1026</span></li>
<li role="button">06/27<span class="rightData">1027</span></li>
<li role="button">06/28<span class="rightData">1028</span></li>
<li role="button">06/29<span class="rightData">1029</span></li>
<li role="button">06/30<span class="rightData">1030</span></li>
<li role="button">07/01<span class="rightData">1031</span></li>
<li role="button">07/02<span class="rightData">1032</span></li>
<li role="button">07/03<span class="rightData">1033</span></li>
<li role="button">07/04<span class="rightData">1034</span></li>
<li role="button">07/05<span class="rightData">1035</span></li>
<li role="button">07/06<span class="rightData">1036</span></li>
<li role="button">07/07<span class="rightData">1037</span></li>
<li role="button">07/08<span class="rightData">1038</span></li>
<li role="button">07/09<span class="rightData">1039</span></li>
</ul>
</div>
<div id="footer">
<p>
footer
</p>
</div>
</div>
Not sure whether this helps but you can try setting the VoiceOver focus manually. If you're lucky, this might also scroll to the correct position.
If that does not work, you could try to use Element.scrollIntoView() which should work in the latest versions of Safari Mobile. But I am not sure whether that also plays nicely with VoiceOver.
The trick to making pages scrollable in Voiceover is to keep main content areas in the normal document flow using position:relative, not absolute. (I think overflow: hidden and max-height: 100% on the body element causes problems too, but I need to do more research.) The nav can use fixed positioning and slide in next to the rest of the content. One limitation is that a menu that also overflows the page height probably won’t scroll in Voiceover, as it will suffer from the original positioning bug.
I have a nav-bar and sub-nav bar like this:
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class=<?php if ($currentPage=='about')
echo ' "active" '; ?> "dropdown">ABOUT
<ul class="dropdown-menu" role="menu">
<li class="abt-firstcell">OUR STORY</li>
<li class="abt-secondcell">OUR TEAM</li>
</ul>
</li>
<li <?php if ($currentPage=='advertising')
echo ' class="active" '; ?> class="dropdown">ADVERTISING
<ul class="dropdown-menu" role="menu">
<li class="adv-firstcell">HOW IT WORKS</li>
<li class="adv-secondcell">OUR PARTNERS</li>
</ul>
</li>
</div>
CSS of it:
.abt-secondcell{
text-align:left;
}
.abt-firstcell{
width:500px;
padding-left:30px;
text-align:right;
border-right:2px solid black;
}
.adv-secondcell{
text-align:left;
}
.adv-firstcell{
width:500px;
padding-right:0;
padding-left:450px;
text-align:right;
border-right:2px solid black;
}
.nav { margin-bottom: 0; }
.nav > li.dropdown:hover { position: static; }
.nav > li.dropdown:hover .dropdown-menu, .nav > li.active:hover .dropdown-menu {
display:table;
width: 100%;
text-align: center;
left:0;
right:0;
background:#E1E0DE;
}
.dropdown-menu>li{
display: table-cell;
}
I followed this example to create the subnav bar on bootstrap 3 to work on hover. But now the problem is, when a page is ACTIVE, the subnav bar doesn't work as it is supposed to. I am quite sure this is a problem with the CSS but can't really figure out what's happening. On every page, I declare $currentPage to be something so that the header knows what page it is in.
The problem is, when I am in the About page, it's active and when I hover on the About tab, doesn't work properly like when it works when I hover on Advertising. Basically the ACTIVE tag messes it up. Can someone please tell me what's wrong?
You have 2 class attribute on the same element, change it to:
<li class="dropdown<?php if ($currentPage=='advertising') echo ' active'; ?>">
(And do the same for the other instances)
I have created a mobile menu.
Now I need to create a submenu in that menu.
There are two problems that occur while clicking the link to open the submenu.
The submenu opens behind the 1st level menu and should push the first level down.
If I "click" (how do you call it on a phone?) the link that opens a submenu it directly goes to the page, obvious but I have created menus that are mouse over for desktop and on a mobile device I was able to click the menu item twice so I could open the submenu.
Here is the HTML output!
<div class="menu-head-menu-container open">
<ul id="menu-head-menu" class="menu">
<li id="menu-item-30" class="menu-item menu-item-has-children">
<ul class="sub-menu">
<li id="menu-item-47" class="menu-item menu-item-47">
<li id="menu-item-50" class="menu-item menu-item-50">
</ul>
</li>
<li id="menu-item-29" class="menu-item menu-item-29">
</ul>
</div>
Here is the CSS for the submenu.
menu-head-menu-container > ul > li > ul {
display:block;
list-style: none;
padding: 0;
margin: 0;
text-align: left;
margin: 10px 0 0 -10px;
background-color: #FFFFFF;
}
This is the css from the 1st level menu items:
.menu-head-menu-container > ul > li {
display: block;
height: 40px;
background: #006185;
width: 100%;
margin: 0;
padding: 6px 0 0 0;
border-bottom: 1px solid #FFF;
}
I don't really see why the subpage won't be visible.
M.
if i correctly understand, you can use something like this :
<div class="menu-head-menu-container open">
<ul id="menu-head-menu" class="menu">
<li id="menu-item-30" class="menu-item menu-item-has-children">click
<ul class="sub-menu">
<li id="menu-item-47" class="menu-item menu-item-47">123</li>
<li id="menu-item-50" class="menu-item menu-item-50">123</li>
</ul>
</li>
<li id="menu-item-29" class="menu-item menu-item-29">123</li>
</ul>
</div>
$("#menu-head-menu li").click(function(){
$(this).find("ul").slideToggle();
});
#menu-head-menu ul{
display: none;
}
jsfiddle
The following is a screen capture of the issue that i'm faced with. The drop down menu is supposed to appear under the second menu item in the top menu.
The HTML is,
<nav class="nav">
<ul>
<li class="menu-item">Hi Alexander!</li>
<li class="menu-item"><a>My Account</a>
<div class="my-sub-menu">
<ul class="sub-list">
<li class="list-item"><a>History</a></li>
<li class="list-item"><a>Personal Details</a></li>
<li class="list-item"><a>Preferences</a></li>
<li class="list-item"><a>Bonuses</a></li>
<li class="list-item"><a>Wishlist</a></li>
<li class="list-item"><a>Newsletter</a></li>
<li class="list-item"><a>Invite Friends</a></li>
<li class="list-item"><a>FAQ</a></li>
<li class="list-item"><a>Sign out</a></li>
</ul>
</div>
</li>
<li class="menu-item"><a>Contact Us</a></li>
<li class="menu-item"><a>Chat</a></li>
<li class="menu-item"><a>Chat</a></li>
</ul>
</nav>
The CSS is as follows,
.nav {
margin-top: 2px;
position: relative;
float: right;
}
.nav > ul {
padding: 0;
margin: 0;
}
.menu-item{
list-style: none;
float: left;
}
.menu-item .my-sub-menu {
visibility: hidden;
position: absolute;
padding: 0;
margin: 0;
}
.menu-item:hover .my-sub-menu {
visibility: visible;
}
.list-item {
list-style: none;
}
I need the sub menu to appear under the second item in the top menu. This is only in firefox and IE but chrome renders it perfectly. I cant figure out what the issue is. Is there at least e fix that i could use for these two browsers? or another alternative to get around this issue.
Tahnk you in advance.
If you add position:relative to .menu-item it will make the absolute positioning work from the list item itself. The only draw back is if you are using a percentage based width on your drop down it will take the width of the parent li as 100% so a pixel width may have to be specified.
try doing
.sub-list{
padding:0px !important;
}
and if by second menu u want it to come under contact us
then change the position of the div
<div class="my-sub-menu">
<ul class="sub-list">
<li class="list-item"><a>History</a></li>
<li class="list-item"><a>Personal Details</a></li>
<li class="list-item"><a>Preferences</a></li>
<li class="list-item"><a>Bonuses</a></li>
<li class="list-item"><a>Wishlist</a></li>
<li class="list-item"><a>Newsletter</a></li>
<li class="list-item"><a>Invite Friends</a></li>
<li class="list-item"><a>FAQ</a></li>
<li class="list-item"><a>Sign out</a></li>
</ul>
</div>
into the next li element ie cntact us
kind of a fiddle
fiddle ex