Bootstrap dynamic pills only work once? - css

I'm creating a Sign in/up form. If the login form is displayed then there is a button below Sign up and if you click it then the login form fades and the Sign up form fades in. Then once the Sign up form is displayed clicking Sign in would make the login form be displayed.
However, it only works one time. My client sent me a website template they purchased and wanted me to modify. There are custom CSS files thousands of lines long and it came with it's own version of Bootstrap (CSS and JavaScript) and I'm not sure how they may have modified it. I'm hoping the problem is me and not the template because that would be a nightmare.
Here is my login form/dynamic pill:
<!-- SIGN IN/UP FORM -->
<div class="form-custom text-center container bg-white">
<img src="images/logo.png" alt="">
<!-- TAB CONTENT -->
<div class="tab-content">
<div id="signin" class="tab-pane fade in active">
<!--SIGN IN-->
<form action="" method="post" class="mb-3">
<div class="container px-4">
<input class="form-style" type="email" name="email" placeholder="Email">
<input class="form-style" type="password" name="password" placeholder="Password">
</div>
</form>
<!--SIGN IN-->
</div>
<div id="signup" class="tab-pane fade">
<!--SIGN UP-->
<form action="" method="post" class="mb-3">
<div class="container px-4">
<input class="form-style" type="text" name="first_name" placeholder="First Name">
<input class="form-style" type="text" name="last_name" placeholder="Last Name">
<input class="form-style" type="email" name="email" placeholder="Email">
<input class="form-style" type="password" name="password" placeholder="Password">
</div>
</form>
<!--SIGN UP-->
</div>
</div>
<!-- TAB CONTENT -->
<ul class="nav nav-pills">
<div class="container">
<div class="d-flex flex-row justify-content-center">
<li class="active">
<button data-toggle="pill" href="#signin" class="btn btn-sign">Sign in</button>
</li>
<li>
<button data-toggle="pill" href="#signup" class="btn btn-sign">Sign up</button>
</li>
</div>
</div>
</ul>
</div>
<!-- SIGN IN/UP FORM -->
And then my own style classes compiled from Sass:
.form-custom {
position: absolute;
top: 35vh;
left: calc(90vw - 475px);
width: 475px;
z-index: 5000;
}
#media (max-width: 575.98px) {
.form-custom {
width: 420px;
left: calc(90vw - 420px);
}
}
#media (max-width: 500px) {
.form-custom {
width: 375px;
left: calc(90vw - 375px);
}
}
#media (max-width: 400px) {
.form-custom {
width: 275px;
left: calc(90vw - 275px);
}
}
.form-style {
display: block;
width: 100%;
border-top: 0px;
border-right: 0px;
border-left: 0px;
font-size: 1rem;
}
.form-style:focus {
outline-color: transparent;
}
.btn-sign {
display: inline;
margin: 0px 20px 0px 20px;
border-radius: 0px;
width: 180px;
}
#media (max-width: 575.98px) {
.btn-sign {
width: 162px;
}
}
#media (max-width: 500px) {
.btn-sign {
width: 126px;
}
}
#media (max-width: 400px) {
.btn-sign {
width: 90px;
}
}
Any help would be much appreciated. If additional details are needed please let me know. Thanks.

I commented out the container and flex div's and that fixed the problem.
<ul class="nav nav-pills">
<li class="active">
<button data-toggle="pill" href="#signin" class="btn btn-sign">Sign in</button>
</li>
<li>
<button data-toggle="pill" href="#signup" class="btn btn-sign">Sign up</button>
</li>
</ul>

Related

What is the best way to resize a form depending on the page size?

I have managed it now with just CSS and media query like so.
HTML :
<div class="container-fluid booking-md">
<div class="container-fluid form-inline top-space myform">
<input id="searchInput" onclick="scrollWin()" onkeydown="if($('.pac-container').is(':visible') && event.keyCode == 13) {event.preventDefault();}" onfocus="geolocate()" class="ad1" type="text" name="searchInput" placeholder="Enter pickup address">
<input id="searchInput2" onclick="scrollWin()" onkeydown="if($('.pac-container').is(':visible') && event.keyCode == 13) {event.preventDefault();}" onfocus="geolocate2()" class="ad1" type="text" name="searchInput2" placeholder="Enter Destination ">
<input type="text" class="ad1" placeholder="No. of passengers*">
<input size="12" type="text" class="ad2" placeholder="When">
<input size="12" type="text" class="ad2" placeholder="Time">
<span class="left"><button type="button" class="btn btn-quotes btn-lg">GET QUOTES</button></span>
</div>
<div class="complex">Journey more complex?<span class="gap"></span><button type="button" class="btn btn-callback btn-md ">Request a call back</button> </div>
</div>
and the CSS is :
#media screen and (max-width: 1199px) {
.booking-md {height:230px;}
.myform {padding-left:2%;padding-right:2%;}
.ad1 {width:49%;margin-bottom:5px;}
.ad2 {width:24.2%;margin-bottom:5px;}
}
#media screen and (max-width: 992px) {
.myform {padding-left:5%;padding-right:5%;}
}
#media screen and (max-width: 768px) {
.booking-md {height:370px;}
.myform {padding-left:2.5%;padding-right:2.5%;}
.ad1 {width:98%;margin-bottom:5px;}
.ad2 {width:48.6%;margin-bottom:5px;}
.main {height:240px;}
.typer {font-size: 5rem;}
.small {
margin-left:0px;
margin-top:0px;
height:70%;
width:70%;
float: left;
}
.nav-image-left {
margin: 0;
padding: 0;
margin-right: 0px;
margin-top: 20px;
margin-left: 0px;
float: left;
}
.nav-numberxs {
position:fixed;
font-weight: bold;
font-size: 26px;
float: right;
top: 40px;
left:40px;
color:#362c6e;
}
.nav-numberxs2 {
position:fixed;
font-weight: bold;
font-size: 26px;
float: right;
top: 40px;
left:40px;
color:#ffffff;
}
}
I am making a form that need to be adjusting to the screen size.
Its working fine on a big screen. But when I shrink the window down, it all goes wrong which I expected.
How can I handle this problem?
I have looked into columns and rows, I have also tried to change the input sizes but with no good results.
The easiest way for me to do this is to make 3 different divs for different sizes and use the different form elements, but I can not use the same input ID on same page more than once or can I?
My current code is the following:
<div class="container-fluid booking-md">
<span class="oneway"><button type="button" class="btn btn-oneway btn-lg">One way</button><span class="gap1"></span><button type="button" class="btn btn-return btn-lg">return</button></span>
<div class="container-fluid form-inline top-space myform">
<input id="searchInput" onclick="scrollWin()" onkeydown="if($('.pac-container').is(':visible') && event.keyCode == 13) {event.preventDefault();}" onfocus="geolocate()" class="ad1" type="text" name="searchInput" placeholder="Enter pickup address">
<input id="searchInput2" onclick="scrollWin()" onkeydown="if($('.pac-container').is(':visible') && event.keyCode == 13) {event.preventDefault();}" onfocus="geolocate2()" class="ad1" type="text" name="searchInput2" placeholder="Enter Destination ">
<input type="text" class="ad1" placeholder="No. of passengers*">
<input size="12" type="text" class="ad2" placeholder="When">
<input size="12" type="text" class="ad2" placeholder="Time">
<button type="button" class="btn btn-quotes btn-lg">GET QUOTES</button>
</div>
<div class="complex">Journey more complex?<span class="gap"></span><button type="button" class="btn btn-callback btn-md ">Request a call back</button> </div>
</div>
The following images show what I am trying to achieve:
Big screen
Medium screen
Small screen

Search form with responsive dropdown filter

I need to make responsive dropdown filter in the following search form.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 50px;
}
.dropdown.dropdown-lg .dropdown-menu {
margin-top: -1px;
padding: 6px 20px;
}
.input-group-btn .btn-group {
display: flex !important;
}
.btn-group .btn {
border-radius: 0;
margin-left: -1px;
}
.btn-group .btn:last-child {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.btn-group .form-horizontal .btn[type="submit"] {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.form-horizontal .form-group {
margin-left: 0;
margin-right: 0;
}
.form-group .form-control:last-child {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
#media screen and (min-width: 768px) {
#adv-search {
width: 500px;
margin: 0 auto;
}
.dropdown.dropdown-lg {
position: static !important;
}
.dropdown.dropdown-lg .dropdown-menu {
min-width: 500px;
}
}
</style>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="input-group" id="adv-search">
<input type="text" class="form-control" placeholder="Search for snippets" />
<div class="input-group-btn">
<div class="btn-group" role="group">
<div class="dropdown dropdown-lg">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><span class="caret"></span></button>
<div class="dropdown-menu dropdown-menu-right" role="menu">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="filter">Filter by</label>
<select class="form-control">
<option value="0" selected>All Snippets</option>
<option value="1">Featured</option>
<option value="2">Most popular</option>
<option value="3">Top rated</option>
<option value="4">Most commented</option>
</select>
</div>
<div class="form-group">
<label for="contain">Author</label>
<input class="form-control" type="text" />
</div>
<div class="form-group">
<label for="contain">Contains the words</label>
<input class="form-control" type="text" />
</div>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
</form>
</div>
</div>
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
</script>
</body>
</html>
The width of the dropdown should be as the width of its parent width as the default.
It works fine in large device but the width varies in small devices.
you can get code snippet https://bootsnipp.com/snippets/featured/advanced-dropdown-search.
Any help is appreciated.
Well, this is not clean at all but it would solve your actual problem. Just add:
#media (max-width: 768px) {
.dropdown-menu {
width:calc(100vw - 30px);
right:-39px;
}
}
Notice that you will change a bootstrap class si it would affect any future dropdown menu you may include later. So better if you add your own class to the menu to use this code.

Background of fixed position div extends beyond edge of pop-up

I've created a scrollable pop-up that uses a jQuery plugin to hold the buttons in place at the top of the window as a user scrolls. This works except for one small problem...the white background that I have placed on the div containing the buttons (in order to prevent seeing the content scrolling beneath the buttons) is extending beyond the right edge of the pop-up. I've tried this in both Chrome and Firefox and they both do the same thing. Is there a CSS solution to this problem?
Here's my fiddle - http://jsfiddle.net/donnapep/NhmvH/2/
HTML
<div class="overlay"></div>
<div class="wrapper container modal-content">
<div>
<h1>Weather Settings</h1>
<div class="sticky-wrapper">
<div class="btn-toolbar sticky-buttons">
<button id="save" class="btn btn-primary" type="button">Save</button>
<button id="cancel" class="btn btn-primary" type="button">Cancel</button>
<button id="help" class="btn btn-primary" type="button">Help</button>
</div>
</div>
</div>
<form role="form">
<div class="row">
<div class="col-md-7">
<div class="form-group">
<label for="layout">Layout</label>
<div class="radio">
<input type="radio" name="layout" value="current" data-url="http://s3.amazonaws.com/Widget-Weather-Test/current.html" checked="checked">
<img src="http://s3.amazonaws.com/Widget-Weather-Test/images/thumbs/current-vertical.png" class="img-thumbnail">
<img src="http://s3.amazonaws.com/Widget-Weather-Test/images/thumbs/current-horizontal.png" class="img-thumbnail">
</div>
<div class="radio">
<input type="radio" name="layout" value="three-day" data-url="http://s3.amazonaws.com/Widget-Weather-Test/three-day.html">
<img src="http://s3.amazonaws.com/Widget-Weather-Test/images/thumbs/three-day-vertical.png" class="img-thumbnail">
<img src="http://s3.amazonaws.com/Widget-Weather-Test/images/thumbs/three-day-horizontal.png" class="img-thumbnail">
</div>
<div class="radio">
<input type="radio" name="layout" value="current-and-three-day" data-url="http://s3.amazonaws.com/Widget-Weather-Test/current-and-three-day.html" checked="checked">
<img src="http://s3.amazonaws.com/Widget-Weather-Test/images/thumbs/current-and-three-day-vertical.png" class="img-thumbnail">
<img src="http://s3.amazonaws.com/Widget-Weather-Test/images/thumbs/current-and-three-day-horizontal.png" class="img-thumbnail">
</div>
</div>
</div>
</div>
</form>
CSS
.overlay {
position: absolute;
z-index: 1;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.7);
}
.wrapper {
z-index: 2;
width: 90%;
height: 500px;
margin: 20px auto 0;
overflow: auto;
}
.sticky-buttons {
z-index: 10;
width: 100%;
padding-top: 20px;
padding-bottom: 20px;
background-color: #fff;
}
Javascript
$(document).ready(function () {
$(".sticky-buttons").sticky({
container: $(".wrapper"),
topSpacing: 21
});
});
Thx.
http://jsfiddle.net/4eAeA/
Looking at the docs for that plugin you can use getWidthFrom as an option argument.
$(document).ready(function () {
$(".sticky-buttons").sticky({
container: $(".wrapper"),
topSpacing: 21,
getWidthFrom : $(".wrapper")
});
});
#donnapep, a downside I saw from that plugin is that it does not keep the width in check on resize.
You will also need something like this :
var _stickybuttons = $(".sticky-buttons");
$(window).resize(function () {
_stickybuttons.sticky('update');
});
I changed your jquery to:
$(document).ready(function () {
$(".sticky-wrapper").sticky({
container: $(".wrapper"),
topSpacing: 21
});
});
Some position:absolute; to
.wrapper.container.modal-content
so that it does not extend to the right
and
width:100%;
z-index:20;
in .sticky-wrapper
Fiddle:
http://jsfiddle.net/NhmvH/9/
It moves to left now but you get the idea.
Dont know if by changing your plugin its easier but anyway I hope it helps a bit.

how to get a form side by side to a div

I'm building a menu that scrolls down with the page for example Facebook's menu but i'm having trouble, the form seems to go under the div and i tried making it float left and it still doesn't work, i want to make it so their all lined up in a line.. what am i doing wrong?
here is my code
<div id="topnav">
<div id="nav">
<img src="/img/putlockermedia_logo.png" />
<input type="button" name="button" id="button" value="Shows" />
<input type="button" name="button" id="button" value="movies" />
<form action='/search.php' method='GET'>
<input id='searchbar' type='text' size='65' name='search' placeholder="search for movies & tv shows">
<input id='submit' type='submit' name='submit' value='Search' >
</form>
</div>
</div>
and here is the full css for it :)
<style>
#topnav{
background-color: #999;
height: 45px;
width: 100%;
position: fixed;
left:0px;
top: 0px;
}
#nav{
margin-left: 10px;
}
</style>
Add a wrapper div to the form and float it right
<div id="topnav">
<div id="nav">
<img src="/img/putlockermedia_logo.png" />
<input type="button" name="button" id="button" value="Shows" />
<input type="button" name="button" id="button" value="movies" />
<div id="right">
<form action='/search.php' method='GET'>
<input id='searchbar' type='text' size='65' name='search' placeholder="search for movies & tv shows">
<input id='submit' type='submit' name='submit' value='Search' >
</form>
</div>
</div>
</div>
CSS
<style>
#topnav{
background-color: #999;
height: 45px;
width: 100%;
position: fixed;
left:0px;
top: 0px;
}
#nav{
margin-left: 10px;
}
#right {
float:right
}
</style>
yes you have to use the float:left; width:50%; for form inside the div
check the fiddle link sample

jquery wizard for user registration [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I Want some samples for step by step registrations like a wizard.
i want to use these samples and asp.net page.
Thanks.
You can easily create your own using jQuery - check out this demo
http://jsfiddle.net/nwJFs/
And here's the code
HTML
<div class="step step-1">
<div class="wrap">
<label for="name">Name</label>
<input id="name" type="text" />
</div>
<div class="wrap">
<label for="email">Email</label>
<input id="email" type="text" />
</div>
<div class="wrap">
<label for="phone">Phone</label>
<input id="phone" type="text" />
</div>
<br class="clear-last" />
<a class="button prev" href="#">Previous</a>
<a class="button next" href="#">Next</a>
</div>
<div class="step step-2">
<div class="wrap">
<label for="name">Mobile</label>
<input id="name" type="text" />
</div>
<div class="wrap">
<label for="email">Address</label>
<textarea id="email"></textarea>
</div>
<div class="wrap">
<label for="phone">Phone</label>
<input id="phone" type="text" />
</div>
<br class="clear-last" />
<a class="button prev" href="#">Previous</a>
<a class="button next" href="#">Next</a>
</div>
<div class="step step-3">
<div class="wrap">
<label for="name">Some</label>
<input id="name" type="text" />
</div>
<div class="wrap">
<label for="email">Other</label>
<textarea id="email"></textarea>
</div>
<div class="wrap">
<label for="phone">Fields</label>
<input id="phone" type="text" />
</div>
<br class="clear-last" />
<a class="button prev" href="#">Previous</a>
<a class="button next" href="#">Submit</a>
</div>
CSS
body {
font-family: Trebuchet MS;
font-size: 12px;
}
.wrap {
clear: both;
padding: 8px 0;
}
.wrap label {
display: block;
float: left;
width: 150px;
padding: 4px;
line-height: 12px;
}
.wrap input,
.wrap textarea {
display: block;
font-size: 12px;
line-height: 12px;
float: left;
width: 200px;
border: 1px solid #888;
padding: 4px 8px;
}
.button {
background: #333;
color: #f2f2f2;
display: inline-block;
padding: 4px 8px;
text-decoration: none;
border: 1px solid #ccc;
}
.button:hover {
background: #888;
color: #000;
}
br.clear-last {
clear: both;
margin: 15px 0;
}
.step {
display: none;
}
.step-1 {
display: block;
}
jQuery
$(".next").click(function() {
//store parent
var parent = $(this).parent();
if(parent.next().length) {
parent.hide("slow").next().show("slow");
}
return false;
});
$(".prev").click(function() {
var parent = $(this).parent();
if(parent.prev().length) {
parent.hide("slow").prev().show("slow");
}
return false;
});
check out this one : http://thecodemine.org
having problems with chrome though...
Do you mean, something like this?
jQuery Form Builder
checkout these links for better wizard creation:
techlab-smart wizard: http://techlaboratory.net/smartwizard
https://github.com/techlab/SmartWizard

Resources