I would like to switch the left box with the right box. I am using the function sortable() from jQuery UI. As you see in my code, it works fine for the numbers of 1 and 2 but not for the boxes to switch them left and right.
$(".sort-me").sortable({
connectWith: ".connectedSortable"
});
.title {
background: red;
}
.storename {
background: blue;
}
.row {
margin-top: 1rem;
margin-bottom: 1rem;
}
/* metatag generator relevant */
.mg-item {
display: inline-block;
}
.mg-item-inner {
display: flex;
}
.mg-item-inner .btn-group .btn .name {
margin-right: 1rem;
}
.mg-item-inner>.btn-group:not(.collapsed)>.btn:first-child {
cursor: -webkit-grab;
cursor: grab;
}
.mg-item-inner .input-group-btn:only-child>.btn {
border-radius: 4px;
}
.mg-item-inner>.btn-group,
.mg-item-inner>.input-group {
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 2px 6px rgba(0, 0, 0, 0.04), 0px 10px 20px rgba(0, 0, 0, 0.04);
}
.mg-item-inner>.btn-group+.input-group,
.mg-item-inner>.input-group+.input-group,
.mg-item-inner>.btn-group+.btn-group,
.mg-item-inner>.input-group+.btn-group {
margin-left: -1px;
}
.mg-item span.add {
background: transparent;
color: #444;
padding-left: 0;
margin-left: 0;
}
.mg-item span.add:active {
box-shadow: unset;
color: #313131;
}
.mg-item span.add .fa-plus-circle {
opacity: 0;
}
.mg-item:hover span.add .fa-plus-circle {
opacity: 1;
}
/*# sourceMappingURL=mg.css.map */
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
<div class="container">
<!-- Title -->
<div class="row">
<div draggable="true" class="sort-me title connectedSortable">
<div class="col-md-3">
<div class="mg-item-inner">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" data-container='body' title='Gibt den Seitentitel aus'>
<span class="name">TITLE</span><i class="fas fa-arrows-alt"></i></button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" data-container='body' title="Linie Erweitern / Reduzieren">
<i class="fas fa-swatchbook"></i></button>
</div>
<!-- /btn-group -->
<div class="input-group" role="group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">prefix <i class="fas fa-sort"></i></button>
<ul class="dropdown-menu">
<li>prefix</li>
<li>suffix</li>
<li>none</li>
</ul>
</div>
<!-- /input-btn-group -->
<input type="text" class="form-control">
</div>
<!-- /input-group --><span type="button" class="btn add"><i class="fas fa-plus-circle"></i></span>
</div>
<!-- /mg-item-inner -->
</div>
<!-- /mg-item -->
</div>
<!--STORE NANE -->
<div draggable="true" class="sort-me storename connectedSortable">
<div class="col-md-3">
<div class="mg-item-inner">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" data-container='body' title='Fügt den Storename hinzu'>
<span class="name">STORENAME</span><i class="fas fa-arrows-alt"></i></button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Linie Erweitern / Reduzieren">
<i class="fas fa-swatchbook"></i></button>
</div>
<!-- /btn-group -->
<div class="input-group" role="group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">prefix <i class="fas fa-sort"></i></button>
<ul class="dropdown-menu">
<li>prefix</li>
<li>suffix</li>
<li>none</li>
</ul>
</div>
<!-- /input-btn-group -->
<input type="text" class="form-control">
</div>
<!-- /input-group --><span type="button" class="btn add"><i class="fas fa-plus-circle"></i></span>
</div>
<!-- /mg-item-inner -->
</div>
<!-- /mg-item -->
</div>
</div>
</div>
<div class="sort-me">
<div class="connectedSortable">
<h1>
1
</h1>
</div>
<div class="connectedSortable">
<H1>2</H1>
</div>
</div>
https://jsfiddle.net/mjc9as5L/
What is the reason that the boxes can not be sorted? Is there a CSS issue maybe?
Try to add flex to your row, it might solve your problem.
.container > .row{
display:flex;
flex-direction:row-reverse;
justify-content:start;
}
Related
Might be a misuse of Bootstrap's input group component, but should be achievable.
This is what I have:
And here's how I'd like to have it:
The code that needs fixing:
<div class="cont">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">foo</span>
<span class="input-group-text">bar</span>
<span class="input-group-text">This should stretch.</span>
</div>
<div class="input-group-append">
<button class="btn btn-secondary" type="button">baz</button>
<button class="btn btn-secondary" type="button">qux</button>
</div>
</div>
</div>
div.cont {
border-left: 1px dotted gray;
border-right: 1px dotted gray;
}
fiddle: https://jsfiddle.net/37o25zay/
Use boostrap class flex-grow-1 to allow the element to grow and fill the remaining space (https://getbootstrap.com/docs/4.2/utilities/flex/#grow-and-shrink)
body {
padding: 2em;
}
div.cont {
border-left: 1px dotted gray;
border-right: 1px dotted gray;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<div class="cont">
<div class="input-group">
<div class="input-group-prepend flex-grow-1"> <!-- here -->
<span class="input-group-text">foo</span>
<span class="input-group-text">bar</span>
<span class="input-group-text flex-grow-1">This should stretch.</span> <!-- here -->
</div>
<div class="input-group-append">
<button class="btn btn-secondary" type="button">baz</button>
<button class="btn btn-secondary" type="button">qux</button>
</div>
</div>
</div>
I've problem with responsiveness when i've stacking button with float class. i want all my buttons stick at the end of the content.
body {
background-color: #eeeeee;
}
.bg-a {
background-color: #bbb;
color: #fff;
padding: 3 6px;
margin: 0 5px;
}
#img-top1,
#img-top2,
#img-top3 {
border-radius: 0;
}
header .container .row div a.ss {
padding: 5px 35px 10px 35px;
}
#img-top1 {
border-radius: 0 0 20px 0;
}
#img-top3 {
border-radius: 0 0 0 20px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<!-- Header -->
<header>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-6">
<img id="logo" src="images/logo.png" style="margin-top: 15px;">
</div>
<div class="col-sm-12 col-md-6" style="padding: 0;">
Primary link1
Primary link2
Primary link3
<br style="clear: both;"><br>
<h4 style="background-color: skyblue; clear: both;">
<a class="btn bg-a float-right" href="#" target="_blank"><i class="fa fa-glide-g"></i></a>
<a class="btn bg-a float-right" href="#" target="_blank"><i class="fa fa-facebook"></i></a>
<a class="btn bg-a float-right" href="#" target="_blank"><i class="fa fa-twitter"></i></a>
<a class="btn bg-a float-right" href="#" target="_blank"><i class="fa fa-linkedin"></i></a>
<a class="btn bg-a float-right" href="#" target="_blank"><i class="fa fa-pinterest-p"></i></a>
</h4>
</div>
</div>
</div>
</header><br>
The button with id img-top is not responsive, meanwhile the icon button with the same class is responsive (maybe because of the small size). How can i make it responsive?
the example of web : RHT Academy
I am trying to create this list-group-item example below with two buttons (instead of just one) that should pull to right and also be of equal height to the list-group-item itself:
At the moment I do have the skeleton working, but as you can see they are not positioning correctly.
Thanks.
li.group-btn {
padding: 0;
border-radius: 0;
}
.form-control,
.btn {
border-radius: 0 !important;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item">
<div class="input-group">
<span class="pull-right">
<button class="btn btn-default" type="button">Go!</button>
</span>
<span class="pull-right">
<button class="btn btn-default" type="button">Go!</button>
</span>
<span class="left">Cras justo odio</span>
</div>
<!-- /input-group -->
</li>
</ul>
</div>
You can use i.e display: table; / display: table-cell;
li.group-btn {
padding: 0;
border-radius: 0;
}
.form-control,
.btn {
border-radius: 0 !important;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item">
<div class="input-group" style="display:table; width:100%;">
<span style="display: table-cell; border:1px solid #ccc; padding: 0 8px; vertical-align: middle;">Cras justo odio</span>
<span style="display: table-cell; width: 40px;">
<button class="btn btn-default" type="button"><span>ᐅ</span> Go!</button>
</span>
<span style="display: table-cell; width: 40px;">
<button class="btn btn-default" type="button"><span>ᐅ</span> Go!</button>
</span>
</div>
<!-- /input-group -->
</li>
</ul>
</div>
Currently working on my navbar and would like to have the width of the search bar wider so the navbar does not look too segmented. I've played around with the width on CSS and haven't had any luck. I've also looked at similar questions on this site but have not found the solution. Please see my code below.
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">HELLO</a>
</div>
<!-- SEARCH FORM -->
<form id="navsearch" class="navbar-form pull-right" role="search" action="" method="post">
<div class="input-group" display="inline">
<input name="search" type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button class="btn btn-default btn" name="submit" class="btn btn-lg" type="submit">
<span class="glyphicon glyphicon-search" ></span>
</button>
</div>
</form>
<!--Button to Upload Information -->
<div class="container text-center">
<div class="call-to-action">
Upload Your Story
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Submit</h4>
</div><!-- end modal-header -->
<div class="modal-body">
<h4></h4>
<p><small class="text-muted">Tell us</small></p>
<form action="forms.php" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-lg-2 control-label" name="name" >Name</label>
<div class="col-lg-10">
<input class="form-control" name="name" placeholder="Name" type="text">
</div>
</div>
<div class="form-group" method="post">
<label class="col-lg-2 control-label" name="yourStory">Your Tell All</label>
<div class="col-lg-10">
<textarea class="form-control" name="yourStory" placeholder="Tell us your story" rows="3"></textarea>
</div>
<div class="form-group">
<label class="col-lg-2" for="inputFile">File input</label>
<input type="file" name="inputfile" id="inputFile">
</div>
<br>
<div class="form-group">
<div class="col-lg-10">
<button name="submit" class="btn btn-success active" type="submit">Submit</button>
</div>
</div>
</form>
</div><!-- end modal-body -->
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">Close</button> <button class="btn btn-primary" type="button">Save changes</button>
</div><!-- end modal-footer -->
</div><!-- end modal-content -->
</div><!-- end modal-dialog -->
</div><!-- end myModal -->
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
CSS
/* --------------------------------------
Navbar
-------------------------------------- */
.navbar-default {
border-color: rgba(255,255,255, 0.7);
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
background-color: rgba(255,255,255, 0.7);;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
#searchInput {
width: 200px;
}
.navbar-brand {
padding: 13px 15px;
}
#mainNav{
padding-top: 10px;
padding-left: 20px;
}
#search{
width: 500px;
This may help as it's an alternate way of setting up your navbar so you can adjust your search input to whatever makes sense and use media queries with it.
*I also adjusted your modal because it was in the from place and had some errors in it etc. See working example.
body,
html {
margin-top: 60px;
}
.navbar.navbar-custom {
border: none;
background: white;
-webkit-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.15);
-moz-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.15);
box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.15);
}
.navbar.navbar-custom .form-search {
right: 0;
top: 0px;
position: fixed;
margin: 0;
border: none;
}
.navbar.navbar-custom .form-search .search-box {
height: 50px;
border-radius: 0;
border: none;
width: 700px;
box-shadow: none;
outline: none;
}
.navbar.navbar-custom .btn.btn-search {
height: 50px;
border-radius: 0;
border: none;
background: grey;
color: white;
}
.navbar.navbar-custom .btn.btn-upload {
float: 0;
height: 50px;
border-radius: 0;
border: none;
background: #a94442;
color: white;
}
.navbar.navbar-custom .navbar-header .navbar-toggle,
.navbar.navbar-custom .navbar-header .navbar-toggle:hover,
.navbar.navbar-custom .navbar-header .navbar-toggle:focus {
background: none;
border: none;
}
.navbar.navbar-custom .navbar-header span.icon-bar {
background: #444;
}
#media (min-width: 768px) {
.navbar.navbar-custom {
height: 50px;
}
}
#media (max-width: 992px) {
.navbar.navbar-custom .form-search .search-box {
width: 500px;
}
}
#media (max-width: 767px) {
.navbar.navbar-custom .form-search {
right: 70px;
}
.navbar.navbar-custom .form-search .search-box {
width: 225px;
}
}
#media (max-width: 480px) {
.navbar.navbar-custom .navbar-brand {
display: none;
}
.navbar.navbar-custom .form-search .search-box {
width: 70%;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
</button> <a class="navbar-brand" href="#">HELLO</a>
</div>
<div class="collapse navbar-collapse" id="bs-nav">
<ul class="nav navbar-nav">
<li>Home
</li>
</ul>
</div>
</div>
<form class="form-search">
<div class="input-group"> <span class="input-group"> <span class="input-group-btn" role="group" aria-label="...">
<button type="button" href="#myModal" data-toggle="modal" class="btn btn-upload">Upload</button>
</span>
<input type="text" class="form-control search-box" placeholder="Search"> <span class="input-group-btn" role="group" aria-label="...">
<button type="button" class="btn btn-search"><i class="fa fa-search"></i></button>
</span> </span>
</div>
</form>
</nav>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Submit</h4>
</div>
<!-- end modal-header -->
<div class="modal-body"> <small class="text-muted">Tell us</small>
<form action="forms.php" method="post" class="form-horizontal">
<label for="name" name="name">Name</label>
<input class="form-control" name="name" placeholder="Name" type="text">
<br>
<label for="yourStory" name="yourStory">Your Tell All</label>
<textarea class="form-control" name="yourStory" placeholder="Tell us your story" rows="3"></textarea>
<br>
<label for="inputFile">File input</label>
<input type="file" name="inputfile" id="inputFile">
<br>
<button name="submit" class="btn btn-success active" type="submit">Submit</button>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">Close</button>
<button class="btn btn-primary" type="button">Save changes</button>
</div>
</div>
</div>
</div>
<!-- end myModal -->
<div class="container">
<div class="alert alert-info">Yo</div>
</div>
I'm trying to solve the various issues with Bootstrap input-group placed inside navbar. The formatting http://bootply.com/101777
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<span class="navbar-brand">Game</span>
</div>
<form class="navbar-form navbar-left itg-game">
<div class="form-group itg-first">
<div class="input-group">
<span class="input-group-addon" ng-bind="first.name"></span>
<input type="text" class="form-control" readonly ng-model="first.value">
</div>
</div>
<div class="form-group">
<div class="btn-group itg-action">
<button ng-click="swap()" class="btn btn-default itg-action-btn" ng-bind="text"></button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href ng-click="resetGame()">Reset game</a></li>
</ul>
</div>
</div>
<div class="form-group itg-second">
<div class="input-group">
<input type="text" class="form-control" readonly ng-model="second.value">
<span class="input-group-addon" ng-bind="second.name"></span>
</div>
</div>
<div class="form-group itg-fee">
<div class="input-group">
<input type="text" class="form-control" readonly ng-model="fee">
<span class="input-group-addon">fee</span>
</div>
</div>
</form>
</nav>
</div>
And the styles:
#media (min-width: 768px) {
.itg-game { }
.itg-game .itg-first, .itg-game .itg-second { width: 12em; }
.itg-game .itg-fee { width: 8em; }
.itg-game .itg-action { text-align: center; }
.itg-game .itg-action .itg-action-btn { width: 15em; }
}
There are two issues:
The mobile view (less than 768px) is completely rubbish - lines overlaps the borders of the navbar, controls stick to the borders.
mid-size version is better but for some reason the third input jumps to the third line.
It looks like the input-groups are not compatible with navbars. Am I right?
They work fine with the navbar with a minimal amount of fiddling with the css, but you can't have it set up like you have it because the size matters. Input groups are display:table and 100% width, they need a col-. If you had too many links or links with really long names, your navbar would break down crappily.
DEMO http://jsbin.com/putuki/1/edit
<div class="navbar navbar-default navbar-static-top my-navbar">
<button class="navbar-toggle visible-xs" data-target=".navbar-collapse" data-toggle="collapse" type="button"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"><!--empty--></span> <span class="icon-bar"><!--empty--></span> <span class="icon-bar"><!--empty--></span></button>
<div class="container visible-xs">
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse" id="mynavcollapse">
<div class="container">
<div class="row">
<form>
<div class="col-sm-2 hidden-xs">
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="col-sm-2">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
<div class="col-sm-2">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
<div class="col-sm-3">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
<div class="col-sm-3">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
</form>
</div>
</div>
</div>
</div>
CSS
.my-navbar .row [class*="col-"] {
margin-top: 10px
}
#mynavcollapse {
clear: both;
padding: 0 0 10px;
background: #eee;
}
#media (min-width: 768px) {
.my-navbar .navbar-brand {
float: none;
display: inline-block;
padding: 7px 0 0 0;
}
.my-navbar .row {
margin-left: -.5%;
margin-right: -.5%;
}
.my-navbar .row [class*="col-"] {
min-height: 1px;
padding-left: .5%;
padding-right: .5%;
padding-top: 10px;
margin-top: 0;
}
}