I know it's strange, but I've take the code with a menu bar whitout nav tag ..
What I would like : Have a hamburger icon (it's ok). When the user click on it, the menu slide down slowly (I'm using slideToggle function with jQuery).
For that, the menu has to be hidden, but if I hide it in small screen (phones) it's also hidden on large screen !
What I have : This code :
<div class="col-xs-1 hidden-sm hidden-md hidden-lg">
<span id="hamburger"><i class="fa fa-bars fa-2x" aria-hidden="true"></i></span>
</div>
<div class="col-xs-12 col-sm-8 menu-nav hidden-xs">
<div class="row text-center">
<a href="{{ path('jt_concours_index') }}">
<div class="col-md-2 col-sm-2 botborder concours"><span class="menu_valign">le concours</span>
</div>
</a>
<a href="#">
<div class="col-md-2 col-sm-2 botborder nos-produits"><span class="menu_valign">nos produits</span>
</div>
</a>
</div>
</div>
JS :
$('#hamburger').on('click', function(){
if ($('.menu-nav').hasClass('hidden-xs')){
$('.menu-nav').removeClass('hidden-xs');
} else {
$('.menu-nav').addClass('hidden-xs');
}
$('.menu-nav').slideToggle('slow');
});
But it's not working .. Have an idea ?
EDIT
I finally used collapse class from bootstrap, like this :
<button class="toggle" data-toggle="collapse" data-target=".menu-nav">
<span id="hamburger"><i class="fa fa-bars fa-2x" aria-hidden="true"></i></span>
</button>
<div class="col-xs-12 col-sm-8 menu-nav collapse">
<div class="row text-center">
<a href="{{ path('jt_concours_index') }}">
<div class="col-md-2 col-sm-2 botborder concours"><span class="menu_valign">le concours</span>
</div>
</a>
<a href="#">
<div class="col-md-2 col-sm-2 botborder nos-produits"><span class="menu_valign">nos produits</span>
</div>
</a>
And now it's working fine. Thanks :)
did you try to change it from display: none to eg display: block instead of working with the hidden-nn classes? you could also create your own hidden class for it.
Related
I have a issue with vertical alignment in a container. I have the following code that does what I want, that is, the first row in the center and the second at the bottom of the container.
Full screen
<header class="masthead" id="home">
<div class="container h-100">
<div class="row h-100 align-items-center justify-content-evenly text-center">
<div class="col-4">
<img src="assets/img/profil.png" class="rounded-circle img-fluid" alt="...">
<hr class="divider" />
<h1 class="text-white font-weight-bold">d3vyce</h1>
</div>
<div class="col-md-8 col-lg-4">
<h2 class="text-white font-weight-bold">Hi 👋, Welcome to my Site!</h2>
<p class="text-white">Developer, CTF Player, Homelab, 3D Printing</p>
<hr class="divider" />
<div class="d-grid col-6 mx-auto">
<a class="btn btn-outline-light btn-lg" href="https://blog.d3vyce.fr" target="_blank"><i class="fa fa-bookmark fa-lg"></i> Blog</a>
<a class="btn mt-2 btn-outline-light btn-lg" href="https://github.com/d3vyce" target="_blank"><i class="fa fa-github fa-lg"></i> Github</a>
</div>
</div>
</div>
<div class="row head-row justify-content-center">
<div class="col-12 mouse_scroll p-0">
<a href="#about">
<div class="mouse">
<div class="wheel"></div>
</div>
<div>
<span class="m_scroll_arrows unu"></span>
<span class="m_scroll_arrows doi"></span>
<span class="m_scroll_arrows trei"></span>
</div>
</a>
</div>
</div>
</div>
</header>
For the alignment at the bottom of the second row I use the following CSS:
.mouse_scroll {
display: block;
width: 24px;
height: 100px;
position: absolute;
bottom: 0; }
The problem happens with the responsive. The columns of the first row are well one on top of the other, but the space between the two is much too important and I can't modify it :(
I tried to search on stackoverflow for answers, but after many tests I'm in a dead end...
Reponsive
Thank you in advance for your answers!
I was working with bootstrap and found out a weird issue. When using collapse button, page width is changed (changes to lower), when I press collapse again to hide the shown content, page is reset to normal. What can be causing the issue?
<a class="btn btn-icon btn-light" data-toggle="collapse" href="#article-content1" role="button" aria-expanded="false" aria-controls="article-content1">
<i class="fas fa-minus"></i>
</a>
<div class="collapse" id="article-content1">
<div class="card-body">
You can show or hide this card.
</div>
<div class="card-footer">
<div class="container-fluid">
<div class="row">
<div class="col-1">
<img alt="image" src="./assets/img/avatar/avatar.png" class="rounded-circle avatar-outline ml-autox" alt="" width="46" height="46" style="margin-top:-3px">
</div>
<div class="col-6 text-left">
<strong>Jasmine Snow</strong></br>
<span class="color-muted">November 11, 2020</span>
</div>
<div class="col-5"><!-- empty --></div>
</div>
</div>
</div>
</div>
I am creating an angular application in which i have an detail page with a cardheader which consist of two buttons namely back and edit and both sides and a text in between.
I have used bootstap and set the columns like below.
But when i see the screen in mobile view the header is not aligned properly
Below is the code i am using. How could i fix it to view in a single line in mobile view
<div class="card-header">
<div class="row">
<div class="col-sm-3 col-lg-3 text-left">
<button size="sm" class="btn btn-primary" (click)="goBack()">
<i class="fa fa-chevron-left"></i> Back
</button>
</div>
<div class="col-sm-6 col-lg-6 text-center">
<h4>Switch Detail</h4>
</div>
<div class="col-sm-3 col-lg-3 text-right">
<button size="sm" class="btn btn-primary" (click)="gotoEdit()">
<i class="fa fa-pencil"></i> Edit
</button>
</div>
</div>
</div>
There is a couple of approach you can follow.
You could force the width of the container to stay constant on all views. Note that this can cause your text to overflow.
<div class="card-header">
<div class="row">
<div class="col-3 text-left">
<button size="sm" class="btn btn-primary" (click)="goBack()">
<i class="fa fa-chevron-left"></i> <span class="button-text"> Back
</span>
</button>
</div>
<div class="col-6 text-center">
<h4>Switch Detail</h4>
</div>
<div class="col-3 text-right">
<button size="sm" class="btn btn-primary" (click)="gotoEdit()">
<i class="fa fa-pencil"></i> <span class="button-text"> Edit </span>
</button>
</div>
</div>
</div>
You could use #media Query to hide the text on the buttons leaving only the icons on a mobile view.
#media screen and (max-width: 560px) {
button-text {
display: none;
}
}
Alternatively, you could reduce the font size of the title on mobile using the same approach in case 2 above.
I'm creating my first HTML website using Bootstrap, and I have been following this template: Freelancer - Start Bootstrap.
I've been able to customize the template to fit my needs for the most part. However, I have not been able to figure out how I can make it so that when I hover over a picture, you get the color overlay and the YouTube logo appears, and then when you click on the transparent overlay, the link opens.
With the template I'm using, there is an example of this, included below, but instead of a modal opening when you click on the overlay, I want an external URL to open. To do this, I thought I could just change the href to point to the external URL, but this doesn't seem to work. I can right click and open in a new window, but clicking on the overlay does nothing.
Image with overlay & logo:
<div class="col-md-4 col-lg-3">
<a class="portfolio-item d-block mx-auto" href="#s-sign">
<div class="portfolio-item-caption d-flex position-absolute h-100 w-100">
<div class="portfolio-item-caption-content my-auto w-100 text-center text-white">
<i class="fa fa-search-plus fa-3x"></i>
</div>
</div>
<img class="img-fluid" src="img/project/s_sign.png" alt="">
</a>
</div>
Modal that pops up when clicked on:
<div class="portfolio-modal mfp-hide" id="s-sign">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Decorative Sign</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="img/project/s_sign.png" alt="">
<p class="mb-5">The frame is made from poplar. The slats are red oak. The "S" is MDF and was cut out by hand.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
My attempt to modify the href to point to an external URL instead of the modal section:
<div class="col-md-6 col-lg-4">
<a class="projects-item d-block mx-auto" href="https://youtu.be/qXev3N5QE9A">
<div class="projects-item-caption d-flex position-absolute h-100 w-100">
<div class="projects-item-caption-content my-auto w-100 text-center text-white">
<i class="fa fa-youtube fa-3x"></i>
</div>
</div>
<img class="img-fluid" src="img/youtube/tote.png" alt="">
</a>
</div>
I know how to make it so I can click on the image, and the URL opens, as seen below, but I want to have the overlay and logo appear when hovering.
<div class="col-md-6 col-lg-4">
<a class="nav-link external" href="https://youtu.be/zjTrW9-GrSs">
<img class="img-fluid" src="img/youtube/tote.png" alt="">
</a>
</div>
However over image to reveal overlay, can right-click to open, but cannot click to open:
This might get you started.
Within your bootstrap column, create a container div that is the approx shape of the images/overlays you wish to move one on top of the other.
Within the container div, which should be made position:relative, make two more container divs, both position:absolute (so then can sit exactly one on top of the other)
Inside each pos:abs container div go your specific image and your youTube logo/overlay.
Then you can use javascript/jquery to swap them around on hover (or mouseenter/mouseleave).
$('.myImg').mouseenter(function(){
$(this).fadeOut();
$(this).next().fadeIn();
});
$('.ytLogo').mouseleave(function(){
$(this).fadeOut();
$(this).prev().fadeIn();
});
$('.ytLogo').click(function(){
$(this).find('a').click();
});
.ytContainer{position:relative;}
.myImg{position:absolute;height:50px;width:50px;}
.ytLogo{display:none;}h
.w-100{width:100px;}
.h-100{height:100px;}
.fa{width:100px;height:100px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<div class="col-xs-6 col-md-6 col-lg-4">
<div class="ytContainer">
<div class="myImg">
<img class="img-fluid ytImg" src="http://placeimg.com/100/100/animals" alt="">
</div>
<div class="ytLogo">
<a class="projects-item d-block mx-auto" href="https://youtu.be/qXev3N5QE9A">
<div class="projects-item-caption d-flex position-absolute h-100 w-100">
<div class="projects-item-caption-content my-auto w-100 text-center text-white">
<i class="fa fa-youtube fa-3x"></i>
</div>
</div>
</a>
</div>
</div>
</div>
i want to show 3 tiles in a one row. 3 tiles should come in one row in the mobile view also.now im able to see only 3 tiles in one row but in mobile its showing two tiles in a row. how to make 3 tiles should cover complete row and same 3 tiles i need to show mobile also .im using adminlte theme for the design
code pen
https://codepen.io/krishnakernel/pen/VQQyaV
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<h3>64 ℃<sup style="font-size: 20px"></sup></h3>
<p><span>Oil Temperature</span></p>
</div>
<div class="icon">
<i class="fa fa-thermometer-3"></i>
</div>
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner">
<h3>88<span style="font-size:30px">Amp</span></h3>
<p>R Current </p>
</div>
<div class="icon">
<i class="fa fa-flash"></i>
</div>
<a href="" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<h3>233 <span style="font-size:20px">âš¡</span> </h3>
<p>R Voltage in kva</p>
</div>
<div class="icon">
<i class="fa fa-bolt"></i>
</div>
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>
You didnt close the div properly
Change <div class="col-lg-3 col-xs-4">
Try changing the classes to col-xs-4 for all the elements you want to have displayed in a row.
In bootstrap, the grid summ need to be equal 12. Then if you want the xs to be a row, you need to change to col-xs-4 because you only have 3 div.
Check more info here: https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp
If you want your layout to always be three columns use the xs breakpoint. The different breakpoints are designed to change the layout based on screen size.