Dropdown Menu Automatically Open in IE - html

I'm making a landing page for a client with a dropdown menu. I'm using bootstrap. I've been having an issue where the dropdown options are already expanded on page load, but only for IE. They also do not have any of the normal formattings for an 'expanded' dropdown (background color should be white, it's not, etc.) Instead, all the li are translucent gray. The options are hoverable and selectable, but the dropdown menu will not close (the caret is essentially unresponsive).
This problem has happened before, on other sites, for this same client. The weirdest thing is, in the past, I have been able to get it to work by merely uploading the folder again to the client's servers. Same code, not working once, then uploaded again and then working. For the life of me, I can't figure out why this is happening
.hero .hero-selection select {
width: 250px;
border: none;
font-size: 14px;
font-family: Proxima Nova Thin;
-moz-box-shadow: 0 0 0 35px rgba(255, 255, 255, .2);
-webkit-box-shadow: 0 0 0 35px rgba(255, 255, 255, .2);
box-shadow: 0 0 0 35px rgba(255, 255, 255, .2);
background-color: #FFF;
color: #999;
border-radius: 0!important;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
padding: 15px 10px 10px;
}
.hero .hero-form-container .dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
margin: 2px 0 0;
padding: 5px 0;
}
.hero .hero-form-container .dropdown-menu>li>a {
display: block;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
padding: 3px 20px;
}
.hero .hero-form-container ul {
width: 250px;
top: 91px;
border-radius: 0;
border: none;
background-color: #FFF;
color: #999;
padding: 0;
}
.hero .hero-form-container ul li a:hover {
background-color: #99d425;
font-family: Proxima Nova Thin;
font-size: 14px;
color: #999;
padding: 5px 5px 5px 15px;
}
.hero .hero-form-container ul li a {
font-family: 'Proxima Nova Thin';
font-size: 14px;
color: #999;
text-decoration: none;
padding: 5px 5px 5px 15px;
}
<div class="row">
<div class="col-sm-6 pull-left"><img id="nats-logo" style="" src="img/nats-logo-red.png" alt=""></div>
<div class="col-sm-6">
<div class="hero">
<div class="hero-form">
<div class="dropdown hero-selection">
<h5>Select your utility below:</h5>
<h2 style="margin-top: 20px">My Electricity Utility is:</h2>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-expanded="true"> Select One<span class="caret"></span> </button>
<ul class="dropdown-menu" role="menu">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="notlisted" class="is-active">[not listed]</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="EBG">BGE</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="CNM">Delmarva Power (MD)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="PED">Pepco (DC)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="PEM">Pepco (MD)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="APM">Potomac Edison</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="SME">SMECO</a></li>
</ul>
</div>
<form action="https://one.wglenergy.com/portal/rc_engine_by_ldc.php" id="form1">
<input type="hidden" name="super_rc" value="NATS">
<input type="hidden" name="cust_type" value="RES">
<input type="hidden" name="ldc_g" id="ldc_g">
<input type="hidden" name="ldc_e" id="ldc_e">
<input type="submit" id="go-button" value="See Your Pricing">
</form>
</div>
</div>
</div>
</div>
</div>

Related

CSS underline with same with as above element

I am trying to create the following look:
As you can see on this picture even if there is some padding on the "sub" menu item the border still works.
So here is what I've attempted:
.menu-ul {
list-style-type: none;
}
.menu-li {
padding: 10px 0;
border-bottom: 1px solid rgba(50, 50, 50, 0.3);
width: 100%;
}
a {
font-family: Titillium Web;
font-style: normal;
font-weight: 600;
font-size: 16px;
line-height: 24px;
letter-spacing: 0.02em;
color: #323232;
text-decoration: none;
}
a:hover {
color: #DB091C;
}
.sub-menu-ul {
padding: 0px;
list-style-type: none;
border-top: 1px solid rgba(50, 50, 50, 0.3);
}
.sub-menu-li {
padding: 10px;
width: calc(100% - 20px);
border-top: 1px solid rgba(50, 50, 50, 0.3);
}
hr.solid {
border-top: 3px solid #bbb;
}
<link href="https://pro.fontawesome.com/releases/v5.14.0/css/all.css" rel="stylesheet"/>
<nav style="width: 300px">
<ul class="menu-ul">
<li class="menu-li">
<a href="" >Title </a>
<span style="float: right"><i class="fa fa-angle-down"></i></span>
<div style="display: block">
<ul class="sub-menu-ul">
<li class="sub-menu-li"> <a href="#">
Sub menu item2
</a>
<span style="float: right"><i class="fa fa-angle-right"></i></span>
</li>
</li>
<li class="sub-menu-li"> <a href="#">
Sub menu item2
</a>
</li>
</ul>
</div>
</li>
<li class="menu-li"><a href="" >Title 2</a>
</li>
<li class="menu-li"><a href="" >Title 2</a> </li>
</ul>
</nav>
But I can't seem to get the border right.
Try this, I have changed the padding for menu-li and width of sub-menu-li
.menu-li {
padding: 10px 0;
border-bottom: 1px solid rgba(50, 50, 50, 0.3);
width: 100%;
}
.sub-menu-li {
padding: 10px;
padding-right: 0;
width: calc(100% - 10px);
border-top: 1px solid rgba(50, 50, 50, 0.3);
}

Fixed list item in dropdown menu UL

Its possible to have an LI fixed at a position and make the rest of the LI scrollable?
I want to have a ul where the first item is fixed, since its a search box, and make the other items, that are loaded with ng-repeat, scrollable.
I came to a solution but it's not UX ok...
My html:
<ul ng-if="filter.isSearchListType && hasFilterValues(filter)" class="dropdown-menu">
<li class="individual-search">
<input type="search" ng-model="searchInputText" class="form-group filter-input" placeholder="Nombre o E-mail" />
<i ng-show="searchInputText" class="fa fa-remove clear-search-icon" aria-hidden="true" ng-click="searchInputText = ''; $event.stopPropagation()"></i>
<i class="fa fa-search search-icon" aria-hidden="true" ng-click="$event.stopPropagation()"></i>
</li>
<li>
<ul class="pre-scrollable2">
<li ng-repeat="filterValue in filter.values | searchInData:searchInputText">
<a href="#" ng-click="selectFilterValue(filter, filterValue.id)" ng-class="{ 'selected': isSelectedFilter(filter, filterValue.id) }">
{{filterValue.label}}
</a>
</li>
</ul>
</li>
</ul>
CSS pre-scrollable2 is kinda a copy of dropdown-menu:
.pre-scrollable2 {
max-height: 340px;
overflow-y: scroll;
/*list-style-type: none;*/
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
/*display: none;*/
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}
.pre-scrollable2 > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
.pre-scrollable2 > li > a:hover,
.pre-scrollable2 > li > a:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
In my experience you have to seperate the two lists and stack them on top of eachother to make them look like one list. then the top list set the position to fixed for the fixed search bar then the bottom set overflow to auto to get a scroll effect. create a navbar class set its width to whatever and the height to 100vh
<div class="navbar">
<ul ng-if="filter.isSearchListType && hasFilterValues(filter)" class="searchbar">
<li class="individual-search">
<input type="search" ng-model="searchInputText" class="form-group filter-input" placeholder="Nombre o E-mail" />
<i ng-show="searchInputText" class="fa fa-remove clear-search-icon" aria-hidden="true" ng-click="searchInputText = ''; $event.stopPropagation()"></i>
<i class="fa fa-search search-icon" aria-hidden="true" ng-click="$event.stopPropagation()"></i>
</li>
</ul>
<ul class="bottomlist">
<li ng-repeat="filterValue in filter.values | searchInData:searchInputText">
<a href="#" ng-click="selectFilterValue(filter, filterValue.id)" ng-class="{ 'selected': isSelectedFilter(filter, filterValue.id) }">
{{filterValue.label}}
</a>
</li>
</ul>
</div>
<style>
.navbar {
position: fixed;
left: 0;
top: 0;
bottom: 0;
height: 100vh;
width: 20vw;
}
.searchbar {
postion: fixed;
top: 0;
}
.bottomlist {
overflow: auto;
postion: relative;
}
</style>

Angular 2 : Give value to button based on dropdown menu value

I am new to angular 2.
I have a button and a drop down which is appeared. When I click on any of the option then its value should be given to the button .
.common_select_box {
width: 100%;
}
.common_select_box button {
border: thin #cfdadd solid;
border-radius: 0 !important;
width: 100%;
text-align: left;
padding: 7.45px 12px;
border-radius: 1.5px !important;
}
.common_select_box button .caret {
display: inline-block;
width: 0;
height: 0;
margin-right: 2px;
vertical-align: middle;
border-top: 6px dashed;
border-right: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 14px;
right: 5px;
}
.common_select_box ul.dropdown-menu {
border: 1px solid #cfdadd;
border-radius: 2px;
box-shadow: none !important;
width: 100%;
padding: 0px;
}
.common_select_box ul.dropdown-menu li {
padding: 5px 15px;
font-size: 12px;
list-style-type:none;
}
.common_select_box ul.dropdown-menu li:hover {
background: #edf1f2 !important;
}
<div class="common_select_box">
<!--give open class to below div when clicking on button-->
<div class="input-group-btn dropdown {{dropdown1? 'open':''}}" (click)="dropdown1=!dropdown1">
<button type="button" class="btn btn-default font_size_12 no_box_shadow ticket_info_subline_text_color" dropdown-toggle="" aria-haspopup="true" aria-expanded="false" >Select <span class="caret" style="color: #bfbfbf;"></span></button>
<ul class="dropdown-menu">
<li >Option 1</li>
<li >Option 2</li>
<li >Option 3</li>
</ul>
</div><!-- /btn-group -->
</div>
When I click on option 1 . then its value should be given to button tag.
Any Help Would be great.
Thank You.
This will work,
<div class="common_select_box">
<div class="input-group-btn dropdown {{dropdown1? 'open':''}}"
(click)="dropdown1=!dropdown1">
<button type="button" class="btn btn-default font_size_12 no_box_shadow
ticket_info_subline_text_color" dropdown-toggle=""
aria-haspopup="true" aria-expanded="false">{{selectedNav}}<span
class="caret" style="color: #bfbfbf;"></span> </button>
<ul class="dropdown-menu">
<li (click)="setNav(item)" *ngFor="let item of navs">{{item}}</li>
</ul>
in .ts file
export class PropertyComponent {
selectedNav: any; navs = ['option 1', 'option 2', 'option 3']
ngOnInit() {
this.selectedNav = 'select value';
}
setNav(nav){
this.selectedNav = nav;
}
}

stretch the boxes to have an organized menu with CSS

I have a menu and I want to stretch the boxes in this menu to have an organized one
I tried like this,this is my code:
<div class="col-sm-1">
<ul class="nav-gproS">
<li>
<a style="margin-top: 10px" class="btn btn-action pull-right"
href="" ng-click="go1()">F.Suiveuse</a>
</li>
<li class="active">
<a style="margin-top: 10px" class="btn btn-action pull-right"
href="" ng-click="go2()">Suivi/Poste</a>
</li>
<li>
<a style="margin-top: 10px" class="btn btn-action pull-right"
href="" ng-click="go3()">Personnel</a>
</li>
<li>
<a style="margin-top: 10px" class="btn btn-action pull-right"
href="" ng-click="go4()">Avct OF</a>
</li>
</ul>
</div>
and this is the CSS code:
.nav-gproS {
list-style-type: none;
}
.btn-action {
background: #1f8597;
color: #fff;
border-radius: 0px;
font-weight: 600;
}
.btn {
font-family: 'Open Sans', 'Segoe UI', 'Droid Sans', Tahoma, Arial, sans-serif;
border-width: 0px;
-webkit-box-shadow: inset 0 0px 0px 0px rgba(0,0,0,0.07);
box-shadow: inset 0 0px 0px 0px rgba(0,0,0,0.07);
}
.pull-right {
float: right !important;
}
what I get is a non organized menu,so how can modify my CSS
thanks for help
I'm suggesting adding to your existing <a> tags class .btn-block. Also remove .pull-right and set text-align: right to your .btn-action declaration or add class .text-right.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<style>
.nav-gproS {
list-style-type: none;
}
.btn-action {
background: #1f8597;
color: #fff;
border-radius: 0px;
text-align: right;
/* text right added here*/
font-weight: 600;
}
.btn {
font-family: 'Open Sans', 'Segoe UI', 'Droid Sans', Tahoma, Arial, sans-serif;
border-width: 0px;
-webkit-box-shadow: inset 0 0px 0px 0px rgba(0, 0, 0, 0.07);
box-shadow: inset 0 0px 0px 0px rgba(0, 0, 0, 0.07);
}
.pull-right {
float: right !important;
}
</style>
<div class="col-sm-3">
<ul class="nav-gproS">
<li>
<a style="margin-top: 10px" class="btn btn-action btn-block" href="" ng-click="go1()">F.Suiveuse</a>
</li>
<li class="active">
<a style="margin-top: 10px" class="btn btn-action btn-block" href="" ng-click="go2()">Suivi/Poste</a>
</li>
<li>
<a style="margin-top: 10px" class="btn btn-action btn-block" href="" ng-click="go3()">Personnel</a>
</li>
<li>
<a style="margin-top: 10px" class="btn btn-action btn-block" href="" ng-click="go4()">Avct OF</a>
</li>
</ul>
</div>
.nav-gproS {
list-style-type: none;
}
.nav-gproS a { /*Set a width on your links, so they get the same width*/
width: 150px;
text-align: right;
}
.btn-action {
background: #1f8597;
color: #fff;
border-radius: 0px;
font-weight: 600;
}
.btn {
font-family: 'Open Sans', 'Segoe UI', 'Droid Sans', Tahoma, Arial, sans-serif;
border-width: 0px;
-webkit-box-shadow: inset 0 0px 0px 0px rgba(0,0,0,0.07);
box-shadow: inset 0 0px 0px 0px rgba(0,0,0,0.07);
}
.pull-right {
float: right !important;
}
Since you're using Bootstrap I have another suggestion. Remove the list entirely and add .btn-block to your anchors since Bootstrap can handle anchors as full-width, block-style buttons already.
Check This Out
<div class="col-sm-1">
<a style="margin-top: 10px" class="btn btn-block btn-action" href="" ng-click="go1()">F.Suiveuse</a>
<a style="margin-top: 10px" class="btn btn-block btn-action" href="" ng-click="go2()">Suivi/Poste</a>
<a style="margin-top: 10px" class="btn btn-block btn-action" href="" ng-click="go3()">Personnel</a>
<a style="margin-top: 10px" class="btn btn-block btn-action" href="" ng-click="go4()">Avct OF</a>
</div>
.btn-action {
background: #1f8597;
color: #fff;
border-radius: 0px;
font-weight: 600;
}
.btn {
font-family: 'Open Sans', 'Segoe UI', 'Droid Sans', Tahoma, Arial, sans-serif;
border-width: 0px;
-webkit-box-shadow: inset 0 0px 0px 0px rgba(0,0,0,0.07);
box-shadow: inset 0 0px 0px 0px rgba(0,0,0,0.07);
}

Put input inside select

Is there a way to place an INPUT field inside select?
<select name="menu_files" class="form-control" >
<option value="new_menu"> <input type="text"></option>
</select>
<datalist> Element
The datalist element is intended to provide a better mechanism for this concept.
<input type="text" name="example" list="exampleList">
<datalist id="exampleList">
<option value="A">
<option value="B">
</datalist>
For more information, see
MDN HTML Reference - <datalist> Element
It is not possible to place an INPUT field inside select. You can create your own custom plugin using jquery.
Try the following code:
$(document).ready(function() {
$('.dropdown-menu input').click(function(e) {
e.stopPropagation();
});
$('.dropdown a').click(function() {
$('.dropdown').addClass("open");
});
$('.dropdown-menu li').click(function() {
$('.dropdown-toggle b').remove().appendTo($('.dropdown-toggle').text($(this).text()));
});
});
.nav {
margin-left: 0;
margin-bottom: 20px;
list-style: none;
}
ul,
ol {
padding: 0;
margin: 0 0 10px 25px;
}
.dropup,
.dropdown {
position: relative;
}
.open>.dropdown-menu {
display: block;
}
.nav>li>a {
display: block;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 1px;
overflow: hidden;
background-color: #e5e5e5;
border-bottom: 1px solid #ffffff;
}
.dropdown-menu>li>a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 20px;
color: #333333;
white-space: nowrap;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul class="nav" role="navigation">
<li class="dropdown"> --Select Country--<b class="caret"></b>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop2">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">USA</a>
</li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">UK</a>
</li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Russia</a>
</li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Others <input type="text" id="other"/></a>
</li>
</ul>
</li>
</ul>
We can achive it putting the input tag "next to" and not "inside" the select tag but forcing them into a limited and fixed area like a table td.
function selection(){
var selected=document.getElementById("select1").value;
if(selected==0){
document.getElementById("input1").removeAttribute("hidden");
}else{
//elsewhere actions
}
}
td{
width: 170px;
max-width: 170px;
overflow: hidden;
white-space: nowrap;
}
input{
width: 164px;
}
<table>
<tr>
<td>
<input id="input1" hidden="hidden" placeholder="input data">
<select onchange="selection()" id="select1">
<option value="-1"></option>
<option value="0">-make your own choice-</option>
<option value="1">choice 1</option>
<option value="2">choice 2</option>
</select>
</td>
</tr>
</table>
jsfiddle
You can also code like this.
<label class="text-left text-uppercase mt-1 sidenav-text w-100" for="category" onclick="menuShow();" >Category</label>
<p id="demo"></p>
and in remaining js
<script>
var demo = document.getElementById('demo');
function menuShow(){
demo.innerHTML = `
<input type="radio" name="select" value="women"> Women<br>
<input type="radio" name="select" value="women"> Men<br>
<input type="radio" name="select" value="women"> Kid<br>
<input type="radio" name="select" value="women"> Boy<br>
`;
}
</script>