Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
How to put "plus" picture near menu item ? Here is the link
move the <span class="collapse"> within the <a> tag
then to prevent the link from firing, within the function for collapse simply put
e.preventDefault; or return false;
If you are worried about their distance? look if the elements have width, if yes try to reduce it use display:inline-block, and changing width to min-width.you can wrap the text in a span and add little right margin if needed.
Your elements with class expand and collapse have an absolute positionning with top: 0; right: 0; That means its distance from the top and right edges (from its parent element) are 0 pixels.
What I would personally do in this case (not at all what would be recommended by CSS experts) would be removing the right rule from the class and add an inline style="left: ##px"inside each span.
On my screen, what works best is this combination :
<li class=" level0 nav-2 active level-top m-dropdown menu-style-dropdown parent">
<a href="http://45.55.85.113/products.html" class="level-top">
<span> <span class="category_icon fa fa-tags"></span>SHOP</span>
</a><span class="expand" style="left: 55px"><i class="fa fa-minus-circle"></i></span>
<ul class="level0" style="display: block;">
<li class=" level1 item classic nav-2-1 first parent">
<a href="http://45.55.85.113/products/furniture.html">
<span> <span class="category_icon fa fa-key"></span>Furniture</span>
</a><span class="collapse" style="left: 100px"><i class="fa fa-plus-circle"></i></span>
<ul class="level1">
<li class=" level2 nav-2-1-1 first">
<a href="http://45.55.85.113/products/furniture/patio-furniture.html">
<span>Patio Furniture</span>
</a>
</li>
<li class=" level2 nav-2-1-2">
<a href="http://45.55.85.113/products/furniture/cafe-chairs-and-barstools.html">
<span>Cafe Chairs and Barstools</span>
</a>
</li>
<li class=" level2 nav-2-1-3 last">
<a href="http://45.55.85.113/products/furniture/chairs-seating.html">
<span>Chairs & Seating</span>
</a>
</li>
</ul>
</li>
<li class=" level1 item classic nav-2-2 parent">
<a href="http://45.55.85.113/products/furniture-fixings.html">
<span>Furniture Fixings</span>
</a><span class="collapse" style="left: 135px"><i class="fa fa-plus-circle"></i></span>
<ul class="level1">
<li class=" level2 nav-2-2-4 first">
<a href="http://45.55.85.113/products/furniture-fixings/connectors.html">
<span>Connectors</span>
</a>
</li>
<li class=" level2 nav-2-2-5 last">
<a href="http://45.55.85.113/products/furniture-fixings/insert-nuts.html">
<span>Insert Nuts</span>
</a>
</li>
</ul>
</li>
<li class=" level1 item classic nav-2-3 last">
<a href="http://45.55.85.113/products/electrical.html">
<span>ELECTRICAL</span>
</a>
</li>
</ul>
</li>
or for short :
left: 55px;
left: 100px;
left: 135px;
respectively for Shop, Furniture and Furniture Fixing
Related
I'm having issues with getting my dropdown to work when it's inside a fully clickable card.
Basically what's happening is that I can't click the three dots with the dropdown without it opening the modal. I'm not sure how to separate the two.
I still want the card to be fully clickable but also have the dropdown when I click on the three dots.
My code
<div class="card card-container">
<div class="card-body">
<img class="mr-4" src="images/icon.png" width="30px" height="30px" >
Contact_name
<span class="d-inline float-right">
<div class="dropdown">
<a href="#" id="imageDropdown" data-toggle="dropdown">
<img src="images/ellipsis.png" width="30px" height="30px">
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="imageDropdown">
<li data-toggle="modal" data-target="#editContact" role="presentation"><a class="ml-3" role="menuitem" tabindex="-1" href="#">Edit</a></li>
<li data-toggle="modal" data-target="#deleteContact" role="presentation"><a class="ml-3" style="color: red;" role="menuitem" tabindex="-1" href="#">Delete</a></li>
</ul>
</div>
</span>
</div>
</div>
Fully clickable card:
Modal being displayed:
Dropdown on the card:
I review your code, the problem is that if the card is completely clickable you need to set a style property that indicates that a specific element is on top of the clickable card, in this case z-index property will do the job.
Try the following code:
I added z-index:99 to the dropdown <span> element.
<div class="card card-container">
<div class="card-body">
<img class="mr-4" src="images/icon.png" width="30px" height="30px" />
Contact_name
<!-- Dropdown element -->
<span class="d-inline float-right" style="z-index:99">
<div class="dropdown">
<a href="#" id="imageDropdown" data-toggle="dropdown">
<img src="images/ellipsis.png" width="30px" height="30px">
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="imageDropdown">
<li data-toggle="modal" data-target="#editContact" role="presentation"><a class="ml-3" role="menuitem" tabindex="-1" href="#">Edit</a></li>
<li data-toggle="modal" data-target="#deleteContact" role="presentation"><a class="ml-3" style="color: red;" role="menuitem" tabindex="-1" href="#">Delete</a></li>
</ul>
</div>
</span>
<!-- End of dropdown element -->
</div>
</div>
Definition and Usage: the z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order.
How can I get the two div's inside the list element (part of an ordered list) to display side by side?
The div's in question are with class="dd-handle"and class="btn-group".
I'm using Bootstrap v3.3.4 and Nestable2.js
I've tried the following. In this case, the btn-group displays below the first div.
<li class="dd-item" data-id="id">
<div class="dd-handle">Section name</div>
<div class="btn-group">
<a data-toggle="dropdown" class="dropdown-toggle" role="button">
<span class="icon icon-dots-three-horizontal"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#myModal" id="myModel" data-toggle="modal" data-reportId="id" data-reportName="name">
<span></span>
Rename
</a>
</li>
<li>
<a href="#myOtherModal" data-toggle="modal">
<span></span>
Add New
</a>
</li>
</ul>
</div>
</li>
In this case, the layout and functionality of the Nestable2.js library are completely off.
<li class="dd-item" style="display:flex; flex-direction:row; justify-content: space-around;" data-id="id">
<div class="dd-handle" style="display:flex; flex-direction:column;">Section name</div>
<div class="btn-group" style="display:flex; flex-direction:column;">
<a data-toggle="dropdown" class="dropdown-toggle" role="button">
<span class="icon icon-dots-three-horizontal"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#myModal" id="myModel" data-toggle="modal" data-reportId="id" data-reportName="name">
<span></span>
Rename
</a>
</li>
<li>
<a href="#myOtherModal" data-toggle="modal">
<span></span>
Add New
</a>
</li>
</ul>
</div>
</li>
Try adding style="display: inline" or display: inline-block;, as blocks have a linebreak built into them by default, and this removes that break.
This question already has answers here:
Center a flex item in a row when there are a different number of items on each side
(5 answers)
Closed 5 years ago.
JSFiddle
The point is to make left ul with max-width align left, center block without specified width be always centered (content of this ul may vary) and right ul be always floated to right with max-width in my top navbar.
The main problem is that when I specify widths for ul's flex properties dont't work as I expect: 3rd ul must be aligned to right while the 2nd should take as much space as posible in one line. It's ok with alignment but 3rd ul takes too much space (more than needed) and visually isn't floated to right. If a specify it's width to fix this center aligmnment of 2nd ul won't work. All elements have different width, as far as I know flex can handle only elements with equal width.
However, I guess this is a right bahaviour for flex.
HTML
<nav class="nav_wrapper" role="navigation">
<ul class="nav navbar-nav navbar-left">
<li data-item-id="nav-profile-menu">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</li>
</ul>
<ul class="nav navbar-nav navbar-center">
<li data-item-id="nav-profile-menu">
<a class="summary" data-toggle="tooltip" title="" data-placement="bottom" data-original-title="usd">
<span class="summary-item">USD</span>
<span>
<i class="fa fa-arrow-circle-o-down red hidden-sm hidden-xs" aria-hidden="true"></i>
99 <span class="small-text hidden-sm hidden-xs">-0,0474</span>
</span>
</a>
</li>
<li data-item-id="nav-profile-menu">
<a class="summary">
<span class="summary-item">Brent</span>
<span>
<i class="fa fa-arrow-circle-o-down red hidden-sm hidden-xs" aria-hidden="true"></i>
99 <span class="small-text hidden-sm hidden-xs">-0,86%</span>
</span>
</a>
</li>
<li data-item-id="nav-profile-menu" class="hidden-xs">
<a class="summary">
<span class="summary-item">Ni</span>
<span>
<i class="fa fa-arrow-circle-o-up green hidden-sm hidden-xs" aria-hidden="true"></i>
105,00 <span class="small-text hidden-sm hidden-xs">1,29%</span>
</span>
</a>
</li>
<li data-item-id="nav-profile-menu" class="hidden-xs">
<a class="summary">
<span class="summary-item">Al</span>
<span>
<i class="fa fa-arrow-circle-o-up green hidden-sm hidden-xs" aria-hidden="true"></i>
2131,50 <span class="small-text hidden-sm hidden-xs">0,35%</span>
</span>
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-auth">
<li data-item-id="nav-profile-menu">
<span>reg</span> <i class="fa fa-user-plus"></i><span></span>
</li>
<li data-item-id="nav-profile-menu" data-toggle="tooltip" title="" data-placement="bottom">
<span>auth</span> <i class="fa fa-sign-in"></i>
</li>
</ul></nav>
why you don't use flex + absolute and u use float?
Much cleaner and no need for clear after floats.
.nav_wrapper {
position: relative;
display: flex;
justify-content: center;
}
.navbar-left {
position: absolute;
left: 0;
}
.navbar-auth {
position: absolute;
right: 0;
}
and you can remove the width of ul
I'm developing a web with Ruby on Rails, using Twitter-Bootstrap and Simple-Navigation gem. The navigation menu works fine on any browser, something like this:
When displaying the web on a mobile device and clicking the nav button, the whole menu is displayed on vertical block, enlarging the size of the header to a max. height than can hold the menu. The problem is that opening any submenú increases the size of the menu, overflowing and hiding the last options, as you can see in the comparison:
Any idea?
The code of nav_menu on the mobile version:
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="brand">
<img alt="NRG Consulting logo" src="/assets/nrg-logo.png" title="NRG Consulting">
</div>
<span class="development" id="rails-env"><span>development</span></span>
<div class="container nav-collapse in collapse" style="height: 496px;">
<ul class="nav pull-right align-top">
<li>
<a href="manual_path">
Help
</a>
</li>
<li>
Español <img alt="Switch to English" class="lang" data-locale="en" src="/assets/lang-es.png" title="English">
</li>
</ul>
<ul class="nav pull-right align-bottom">
<li id="home">Home</li>
<li id="formulas">Formulas</li>
<li id="deals">Deals</li>
.
.
.
<li class="active dropdown" id="admin">
Admin <b class="caret"></b>
<ul class="dropdown-menu">
<li id="subscription">Subscriptions</li>
<li class="divider" id="nav_header"></li>
<li id="historic">Recalculate historic prices</li>
<li class="divider" id="nav_header"></li>
<li id="export">export data</li>
<li id="import_tuple_eod_check">Check data</li>
<li class="divider" id="nav_header"></li>
<li id="alerts">Alert</li>
<li id="product_price_alerts">Price alerts</li>
<li id="import_tuples">Import tuple</li>
<li id="fixing_errors">fixing errors</li>
<li class="divider" id="nav_header"></li><li id="redis">Resque</li>
<li id="copycopter">Translate</li>
<li class="divider" id="nav_header"></li>
<li class="active simple-navigation-active-leaf" id="client">Clients</li>
<li id="user">Users</li>
<li id="user_activities">User activity</li></ul></li>
<li id="user">Users</li>
</ul>
</div>
</div>
</div>
</div>
Collapsed nav menu appears to set a fixed height value when displaying nav menu, preventing the div to enlarging when submenu dropdowns display:
<div class="container nav-collapse in collapse" style="height: 496px;">
Adding this lines to style.css set height property to auto, allowing the div to enlarge when needed, showing the whole menu:
.container.nav-collapse.in.collapse{
height: auto !important;
}
Perhaps there is a cleaner solution, but this worked pretty fine for me, and don't want to change Bootstrap code itself.
A link displaying some usefull info about similar issues.
I am having the following problem, shown in pictures:
In Chrome:
note that this cutting submenu, since Firefox is as follows:
Do not understand what may be happening
a snippet of code
<li class="menu-item-link menu-item-depth-3 menuitemslinefirst menu-item-parent" style="background-color: transparent;">
<a class="arrow" href="#">
<span>></span>
</a>
<a href="">
<span>
<img width="5" height="5" style="margin-top:8px; margin-left:10px" src="http://tecorp.com.br/skin/frontend/default/default/images/menu/icone/all.png" alt=""> Teclados
</span>
</a>
<ul class="menu-container" style="display: block;">
<li class="menu-item-text menu-item-depth-4 ">
<ul class="em-catalog-navigation ">
<li class="level0 nav-1 first">
<a href="http://tecorp.com.br/index.php/teclados/teclados-com-fio.html">
<span>Teclados com Fio</span>
</a>
</li>
<li class="level0 nav-2 last">
<a href="http://tecorp.com.br/index.php/teclados/teclados-sem-fio.html">
<span>Teclados sem Fio</span>
</a>
</li>
</ul>
</li>
an image of the css that is affecting this element if you need put the file
------------------------------------- EDIT ----------------------------------
Scouring the internet, by any chance can get where the error, if I take this part .show("slow"); and just put .show(); it work if I use "slow" it does not work in chrome
$("# em_nav").show();
$("# em_nav").show("slow");