Background Image on pseudo elements - css

I am trying to insert background images into each tab as per the screenshot below but because the arrow is created using pseduo elements I am not sure how to do it.
Please see below a snippet of where I am upto so far. The final product should look like the screenshot so I am just missing the images in the background. Be sure to view the snippet in expanded view.
I have tried setting a background image with a colour in front but that didnt work. I cant seem to figure it out for the life of me!
If anyone could help that would be greatly appreciated.
/* CDCD HOMEPAGE */
.u-nav-v8-2 .nav-item:first-child .nav-link {
padding: 35px 85px 35px 135px;
}
.u-nav-v8-2 .nav-link {
padding: 35px 100px 35px 135px;
}
[class*="u-nav-v8"] .nav-link {
background-color: #767577;
}
[class*="u-nav-v8"] .nav-link::after {
background-image: linear-gradient(to left, #767577 0%, rgba(118, 117, 119, 1) 100%);
}
.u-nav-v8-2 .nav-link::before {
background-image: linear-gradient(to bottom left, transparent 49.6%, #767577 50%), linear-gradient(to top left, transparent 49.6%, #767577 50%);
}
[class*="u-nav-v8"] .nav-link.active {
background-color: #B81818;
}
[class*="u-nav-v8"] .nav-link:hover {
background-color: #B81818;
}
[class*="u-nav-v8"] .nav-link:hover:after,
[class*="u-nav-v8"] .nav-link:hover:before {
background-image: linear-gradient(to bottom left, transparent 49.6%, #B81818 50%), linear-gradient(to top left, transparent 49.6%, #B81818 50%);
}
.u-nav-v8-2 .nav-link.active::before {
background-image: linear-gradient(to bottom left, transparent 49.6%, #B81818 50%), linear-gradient(to top left, transparent 49.6%, #B81818 50%);
}
[data-tabs-mobile-type="slide-up-down"] {
padding-top: 0px;
}
[data-tabs-mobile-type="slide-up-down"] .nav-link {
border: none;
border-width: 0px;
border-style: none !important;
}
#media (max-width: 991px) {
.u-nav-v8-2 .nav-item:first-child .nav-link {
padding: 35px 85px 35px 85px;
}
.u-nav-v8-2 .nav-link {
padding: 35px 100px 35px 85px;
}
}
<link href="http://impression.testcre8.co.uk/assets/css/unify-components.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://impression.testcre8.co.uk/assets/vendor/bootstrap/bootstrap.min.js"></script>
<link href="http://impression.testcre8.co.uk/assets/css/unify-core.css" rel="stylesheet" />
<link href="http://impression.testcre8.co.uk/assets/vendor/bootstrap/bootstrap.min.css" rel="stylesheet" />
<!-- CDCD -->
<ul class="nav nav-fill justify-content-center d-flex flex-wrap flex-lg-nowrap u-nav-v8-2" role="tablist" data-target="nav-8-2-primary-hor-center" data-tabs-mobile-type="slide-up-down" data-btn-classes="btn btn-md u-btn-primary btn-block">
<li class="nav-item">
<a class="nav-link active" href="/impression-visual-branding-services/visual-branding-consultancy/">
<h2 class="text-uppercase u-nav-v8__title g-color-white text-left g-mb-5">Consult <i class="fas fa-arrow-right g-pos-rel g-ml-10 material-icons"></i></h2>
<p class="u-nav-v8__description g-color-white introText text-left g-mb-0">Understanding your brief, campaign goals & vision.</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#creativeConcept">
<h2 class="text-uppercase u-nav-v8__title g-color-white text-left g-mb-5">Design <i class="fas fa-arrow-right g-pos-rel g-ml-10 material-icons"></i></h2>
<p class="u-nav-v8__description g-color-white introText text-left g-mb-0">Creative concepts that bring your brief to life.</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#modeling3D">
<h2 class="text-uppercase u-nav-v8__title g-color-white text-left g-mb-5">Create <i class="fas fa-arrow-right g-pos-rel g-ml-10 material-icons"></i></h2>
<p class="u-nav-v8__description g-color-white introText text-left g-mb-0">Fully in-house, quality-assured production.</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#happyClients">
<h2 class="text-uppercase u-nav-v8__title g-color-white text-left g-mb-5">Deliver <i class="fas fa-arrow-right g-pos-rel g-ml-10 material-icons"></i></h2>
<p class="u-nav-v8__description g-color-white introText text-left g-mb-0">Packing, dispatch & on site installation management.</p>
</a>
</li>
</ul>
<!-- END CDCD -->

In order for pseudo element to be visible you must provide content property, e.g. content: ''; in your case. Also don't forget to setup width and height.
[class*="u-nav-v8"] .nav-link::after {
content: '';
display: block;
width: 50px;
height: 50px;
background-image: linear-gradient(to left, #767577 0%, rgba(118, 117, 119, 1) 100%);
}

Related

how to unhide a hidden div with bootstrap

I'm working on a site built on bootstrap and have a column down the right side that contains a search module and some other things. it gets hidden on smaller screens. I'm hoping to restore just the search module (and hide everything else but the footer) when pressing a button that gets displayed in the menu.
It sounded simple, but I can't seem to figure out how to override it being hidden. The visibility is set in the style sheet but I also tried setting the visibility on the div itself with d-none d-lg-block - no go.
With below code, when hitting the button, the main container hides (though sometimes only when pressing it twice) but it doesn't restore the sidebar. Which, based on the different things I've tried appears to be as intended, just not what I'm trying to do with it..
I'm sure it's something simple, but I've been staring at this for far too long and I'm not doing well with googling. Thanks in advance for any help/suggestions.
Update: The comment confirming it was out of the realm of bootstrap helped a lot. Updated code below to use javascript to handle activating the search module and hiding the main content. a simple function only goes one way, so I am also hiding the search button itself on click and displaying a close button that reverses the actions. The next step was to reset everything if the page width changes (as this function is only intended to be for smaller screens/mobile, and if you action any of the buttons and then increase page width things stay hidden that shouldn't) so I added a third function that listens for page width changes and resets the visibility of the impacted divs when the size becomes large enough to properly display. it's working in testing, but I'm open to feedback, tips, etc. to make it better.
My sincere thanks to all who have helped me get here!
```
/* Set gray background color and 100% height */
.sidebar {
padding-bottom: 10px;
background-color: #f1f1f1;
text-align: center;
justify-content: center;
}
/* this adds padding to bottom of main container in order to account for footer image */
.pb-6 {
padding-bottom: 5rem !important;
}
/* hides this div on small size */
#media screen and (max-width: 768px) {
div.sidebar {
display: none;
}
div.footerimage {
display: none;
}
}
#media (min-width: 768px) {
/* hides hamburger on bigger screens */
.navbar-brand{
display: none;
}
.navbar-search{
display: none;
}
.navbar-pressed{
display: none;
}
}
/* Set black background color, white text and some padding */
footer {
background-color: #000;
color: #fff;
padding: 15px;
margin:0;
}
body {
margin: 0px;
}
html {
font-family: "Lucida Sans", sans-serif;
}
/* images scales */
img {
max-width: 100%;
height: auto;
}
h1, h2, h3, h4, h5, h6 {
padding: 0px;
margin: 0px;
}
.header {
background-image: url();
background-size: cover;
background-color: #ffffff;
color: #000000;
padding:0;
margin:0;
text-align: center;
width: auto;
height: 100%;
line-height:0;
}
.navbar-pressed {
display: none;
}
.footerimage {
position: relative;
}
.footerpic {
background-image: url();
background-size: contain;
content: '';
height: 200px;
pointer-events: none;
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -50%);
width: 200px;
}
/* change the background color */
.navbar-custom {
background-color: #1e73be;
margin-bottom: 0;
border-radius: 0;
padding: 0;
}
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
color: #ffffff;
}
/* change the link color */
.navbar-custom .navbar-nav .nav-link {
color: #ffffff;
}
/* change the color of navbar title when collapsed */
.navbar-toggler {
color: #ffffff;
}
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:focus .nav-link,
.navbar-custom .nav-item:hover .nav-link {
color: #ffffff;
background-color: #035a9e;
}
/* for dropdowns only */
.navbar-custom .navbar-nav .dropdown-menu {
background-color: #1e73be;
}
/* dropdown item text color */
.navbar-custom .navbar-nav .dropdown-item {
color: #ffffff;
}
/* dropdown item hover or focus */
.navbar-custom .navbar-nav .dropdown-item:hover,
.navbar-custom .navbar-nav .dropdown-item:focus {
color: #ffffff;
background-color: #035a9e;
}
.navbar-brand img {
height: 30px;
float: left;
margin-left: 20px;
padding: 0;
}
```
```
<!DOCTYPE html><html lang='en'><head><title>menu test</title><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'><META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=iso-8859-1'>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css'><link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css'><link rel='preconnect' href='https://fonts.gstatic.com'><link href='https://fonts.googleapis.com/css2?family=Atma:wght#600&display=swap' rel='stylesheet'><script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js'></script><script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js'></script>
<script>
function myFunction() {
document.getElementById("maincontainer").style.display = 'none';
document.getElementById("sidebar").style.display = 'block';
document.getElementById("sidecontentdiv").style.display = 'none';
document.getElementById("navbar-search").style.display = 'none';
document.getElementById("navbar-pressed").style.display = 'block';
}
</script>
<script>
function myCloseFunction() {
document.getElementById("maincontainer").style.display = 'block';
document.getElementById("sidebar").style.display = 'none';
document.getElementById("sidecontentdiv").style.display = 'block';
document.getElementById("navbar-search").style.display = 'block';
document.getElementById("navbar-pressed").style.display = 'none';
}
</script>
<script>
function doSomething(matches) {
if (matches) {
// media query matches
} else {
// media query does not match
document.getElementById("maincontainer").style.display = "";
document.getElementById("sidebar").style.display = "";
document.getElementById("sidecontentdiv").style.display = "";
document.getElementById("navbar-search").style.display = "";
document.getElementById("navbar-pressed").style.display = "";
}
}
const query = window.matchMedia("(max-width: 767px)");
query.addEventListener("change", ({ matches }) => doSomething(matches));
doSomething(query.matches);
</script>
</head>
<body>
<div class='header'></div>
<nav class='navbar navbar-expand-md navbar-custom sticky-top'><div class='navbar-brand'><a href='https://www.url.com'><img src='/images/menu.png' alt='Logo'></a></div><div id='navbar-pressed' class='navbar-pressed ml-auto'><button class='navbar-toggler' type='button' onclick="myCloseFunction()"><i class='fa fa-circle-xmark fa-flip-horizontal' style='color:#ffffff'></i></button></div><div id='navbar-search' class='navbar-search ml-auto'><button class='navbar-toggler' type='button' onclick="myFunction()"><i class='fa-solid fa-magnifying-glass fa-flip-horizontal' style='color:#ffffff'></i></button></div><button class='navbar-toggler' type='button' data-toggle='collapse' data-target='#navbarCollapse'><span class='ml-auto' role='button'><i class='fa fa-bars' style='color:#ffffff'></i> Menu</span></button><div class='collapse navbar-collapse justify-content-between' id='navbarCollapse'><div class='navbar-nav'>
<div class='nav-item'><a href='index.php' class='nav-link'>Home</a></div>
<div class='nav-item'><a href='index.php' class='nav-link'>Home</a></div>
<div class='nav-item'><a href='index.php' class='nav-link'>Home</a></div></div>
</div></nav>
<div class='container-fluid text-center'>
<div class='row content'>
<div class='col-md-9 text-left pb-6' id='maincontainer'>
main body of page
</div>
<div id='sidebar' class='col-md-3 sidebar'>
<div id='searchdiv'>
<div class='sidebarheader rounded'><h4>Search:</h4></div>
<div class='searchbox rounded'>search module</div>
</div>
<div id='sidecontentdiv'>
<div class='sidebarheader rounded'><h4></h4></div>
<div class='searchbox rounded'>unimportant module</div>
</div></div>
<footer class='container-fluid text-center'>
<div class='row'>footer text</div>
</footer>
</div></div>
</body></html>
```
If it's simply hide/show div, why not use JavaScript / jQuery? Like,
<button onclick="myFunction()">src</button>
<div id="attid"></div>
<script>
function myFunction() {
document.getElementById("attid").style.display = 'none';
// or to show
// document.getElementById("attid").style.display = 'block';
}
</script>
Couldn't comment because lack of reputation :)
I think this will help you! Joe
const opener = document.getElementById('opener');
const sidebar = document.getElementById('sidebar');
const closer = document.getElementById('closer');
opener.onclick = function(){
sidebar.style.marginRight = 0
}
closer.onclick = function(){
sidebar.style.marginRight = 'calc(var(--length) * -1)'
}
body{
overflow:hidden;
}
#sidebar{
--length:280px;
margin-right:calc(var(--length) * -1);
width:var(--length);
transition:all .2s linear;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
<button class="btn btn-primary" id='opener'>opener</button>
<div id = 'sidebar' class="d-flex d-md-none float-end flex-column flex-shrink-0 p-3 bg-light">
<div class="d-flex">
<button class="btn btn-primary" id='closer'>x</button>
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-dark text-decoration-none">
<svg class="bi pe-none me-2" width="40" height="32"><use xlink:href="#bootstrap"></use></svg>
<span class="fs-4">Sidebar</span>
</a>
</div>
<hr>
<ul class="nav nav-pills flex-column mb-auto">
<li class="nav-item">
<a href="#" class="nav-link active" aria-current="page">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#home"></use></svg>
Home
</a>
</li>
<li>
<a href="#" class="nav-link link-dark">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#speedometer2"></use></svg>
Dashboard
</a>
</li>
<li>
<a href="#" class="nav-link link-dark">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#table"></use></svg>
Orders
</a>
</li>
<li>
<a href="#" class="nav-link link-dark">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#grid"></use></svg>
Products
</a>
</li>
<li>
<a href="#" class="nav-link link-dark">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#people-circle"></use></svg>
Customers
</a>
</li>
</ul>
<hr>
<div class="dropdown">
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<img src="https://github.com/mdo.png" alt="" width="32" height="32" class="rounded-circle me-2">
<strong>mdo</strong>
</a>
<ul class="dropdown-menu text-small shadow">
<li><a class="dropdown-item" href="#">New project...</a></li>
<li><a class="dropdown-item" href="#">Settings</a></li>
<li><a class="dropdown-item" href="#">Profile</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Sign out</a></li>
</ul>
</div>
</div>

what do I put in className if I am using CSS module with .active property

Whenever my state in navbar changes, I would like to have the background of NavItems to be transparent when it's false, and add a gradient background when it's true.
I know that if it is normal CSS, I can just put 'NavItems active' as my classNamewith ?operator for if statement, but how do I do this with CSS module?
index.module.css
.NavItems{
background: transparent !important;
height: 100px;
display:flex;
justify-content:center;
align-items:center;
font-size: 1.5rem;
font-weight: bold;
position: sticky;
top:0;
z-index:300;
}
.NavItems.active{
background: linear-gradient(90deg, rgb(61,49,49) 0%, rgba(49,49,49,1)100%) !important;
}
index.jsx
return (
<nav className={navbar ? styles.active : styles.NavItems}>
<div>
<Link to='/'>
<img className={styles.NavLogo} src={logo} alt='LaoMa Logo'/>
</Link>
</div>
<div className={styles.menu_icon} onClick={handleClick}>
<i className={click ? 'fas fa-times' : 'fas fa-bars'}>
</i>
</div>
<ul className={click ? styles.nav_menu.active : styles.nav_menu}>
{NavItems.map((item, index)=> {
return (
<li key={index}>
<Link onClick={closeMobileMenu} className={styles[item.cName]} to={item.url}>
{item.title}
</Link>
</li>
)
})}
</ul>
</nav>
);
Edit: As andy remarked, the first solution i provided may result in weird bugs, therfore it is smarter to use a package like https://www.npmjs.com/package/clsx (like debuchet suggested)
First solution:
className={`${navbar && styles.active} ${styles.NavItems}`}
and then in you css
.NavItems{
background: transparent !important;
height: 100px;
display:flex;
justify-content:center;
align-items:center;
font-size: 1.5rem;
font-weight: bold;
position: sticky;
top:0;
z-index:300;
}
.active {
background: linear-gradient(90deg, rgb(61,49,49) 0%, rgba(49,49,49,1)100%) !important;
}

Put transparent navbar on top of jumbotron - Bootstrap

I'm trying to make a landing page with a big jumbotron at the top and a transparent navbar placed on top of it, like this: https://stripe.com/en-gb-dk. The jumbotron just has a coloured background (i.e. no background image). I have tried fixed-top, which achieves the desired effect; however, I'm not interested in the navbar being fixed to the top (i.e. follow the page on scroll) - I'm just interested in the transparent navbar being on top of the jumbotron. Does anyone know how I can achieve this using bootstrap? Thanks!
Below is my code (I use Bootstrap in conjunction with React)
Navbar:
<nav className={`navbar navbar-expand-md navbar-light bg-transparent`}>
<div className="container-fluid">
<a className="navbar-brand">
<img src="/images/logo.png" alt="" className="img-fluid" />
</a>
<button
onClick={() => setShowMenu(!showMenu)}
className="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon"></span>
</button>
<div className={`collapse navbar-collapse ${showMenu ? "show" : ""}`}>
<div className="navbar-nav mx-auto">
<li className="nav-item active">
<a className="nav-link" href="#">
Link 1
</a>
</li>
<li className="nav-item active">
<a className="nav-link" href="#">
Link 2
</a>
</li>
<li className="nav-item active">
<a className="nav-link" href="#">
Link 3
</a>
</li>
</div>
<div className="nav navbar-nav nav-right">
<li className="nav-item active">
<a className="nav-link" href="#">
Link 4
</a>
</li>
</div>
</div>
</div>
<style jsx>
{`
.navbar .navbar-collapse {
text-align: center;
}
#media (min-width: 992px) {
.nav-right {
float: right;
}
}
`}
</style>
</nav>
Jumbotron:
<section>
<div className="main-jumbotron">
<h1>Let us help you find your next expert</h1>
<h4>
At beautykonect, we have the best experts ready to help you
</h4>
<div className="text-center mt-5">
<button className="btn btn-primary btn-lg outline">Get started</button>
</div>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
preserveAspectRatio="none"
>
<polygon fill="white" points="0,100 100,0 100,100" />
</svg>
</div>
<style jsx>
{`
svg {
position: absolute;
bottom: 0;
width: 100%;
height: 10vw;
}
.main-jumbotron {
position: relative;
height: 90vh;
min-height: 300px;
background: rgb(255, 216, 223);
background: linear-gradient(
90deg,
rgba(255, 216, 223, 1) 0%,
rgba(252, 189, 201, 1) 53%,
rgba(255, 134, 157, 1) 100%
);
}
.main-jumbotron h1 {
padding-top: 125px;
text-align: center;
color: white;
font-weight: 700;
}
.main-jumbotron h4 {
color: white;
margin-top: 25px;
font-weight: 600;
text-align: center;
}
.btn.outline {
background: none;
padding: 12px 22px;
}
.btn-primary.outline {
border: 2px solid #fff;
color: #fff;
}
.btn-primary.outline:hover,
.btn-primary.outline:focus,
.btn-primary.outline:active,
.btn-primary.outline.active,
.open > .dropdown-toggle.btn-primary {
color: rgba(252, 189, 201, 1);
border-color: #fff;
background-color: #fff;
}
.btn-primary.outline:active,
.btn-primary.outline.active {
border-color: #007299;
color: #007299;
box-shadow: none;
}
`}
</style>
<section>
This is what it looks like now
What I want to do then is to make the navbar transparent and push the banner/jumbotron up, such that there is no white section at the top of the page
Edit: added code and photo
Bootstrap provides a utility class position-absolute which will give the desired result but it does not have classes to handle specific positioning properties such as top.
This solution follows the same approach as the example, apply this new style rule in the inline style for the navbar:
.navbar {
position: absolute; // could use 'position-absolute' on navbar instead
top: 0;
left: 0;
width: 100%; // could also use class 'w-100' on navbar instead
}

BootstrapVue Styling of b-list-group and b-list-group-item

So, I am having a rough time trying to style a navbar with social media icons in it. I am trying to achieve something similar to: https://codepen.io/matthew-spire/pen/GVQvJg, but I have no clue how to even go about it.
Right now I just have:
<!-- Social Media Navigation -->
<b-navbar type="dark" variant="dark" class="justify-content-center">
<b-list-group horizontal>
<b-list-group-item href="#" target="_blank"><font-awesome :icon="['fab', 'instagram']" size="2x"/></b-list-group-item>
<b-list-group-item href="#" target="_blank"><font-awesome :icon="['fab', 'facebook-f']" size="2x"/></b-list-group-item>
<b-list-group-item href="#" target="_blank"><font-awesome :icon="['fab', 'twitter']" size="2x"/></b-list-group-item>
<b-list-group-item href="#" target="_blank"><font-awesome :icon="['fab', 'youtube']" size="2x"/></b-list-group-item>
</b-list-group>
</b-navbar>
Any suggestions or places to look? I have already tinkered around and tried to access what I want and style it accordingly, but with nowhere near the results I am trying to achieve.
Here is a working solution that I had a lot of help on. Way more work than I expected.
The HTML:
<div id="app">
<b-navbar toggleable="lg" type="dark" variant="dark" class="justify-content-center">
<!-- Right aligned nav items -->
<b-navbar-nav>
<div class="instagram-circle circle text-center">
<b-link class="social-icon" href="#"><i class="fab fa-instagram fa-lg"></i></b-link>
</div>
<div class="facebook-circle circle text-center">
<b-link class="social-icon" href="#"><i class="fab fa-facebook fa-lg"></i></b-link>
</div>
<div class="twitter-circle circle text-center">
<b-link class="social-icon" href="#"><i class="fab fa-twitter fa-lg"></i></b-link>
</div>
<div class="youtube-circle circle text-center">
<b-link class="social-icon" href="#"><i class="fab fa-youtube fa-lg"></i></b-link>
</div>
</b-navbar-nav>
</b-navbar>
</div>
The CSS:
.social-icon {
color: white;
font-size: 25px;
margin: 5px 5px;
text-align: center;
text-decoration: none;
}
.social-icon:hover {
color: white;
text-decoration: none;
}
.facebook-circle:hover {
background: #4060a5;
}
.twitter-circle:hover {
background: #00abe3;
}
.instagram-circle:hover {
background: #375989;
}
.youtube-circle:hover {
background: #ff1f25 !important;
}
.circle {
background-color: grey;
border-radius: 50%;
display: inline-block;
margin-left: 5px;
margin-right: 5px;
padding: 15px;
}
The JS:
new Vue({
el: "#app",
data() {
return {};
}
});
A link to codepen: https://codepen.io/matthew-spire/pen/mNxbyR
Use the b-navbar-nav and b-nav-item components (instead of the b-list-group, which is not a supported child component of a navbar) to generate the social icon links, and then use Vue-loader's deep selector to style the icons as needed.
https://vue-loader.vuejs.org/guide/scoped-css.html#child-component-root-elements

Horizontal ion-scroll not working

In the project that i am making i used ion-scroll two times and works perfect (vertical mode) but now i am trying to do an horizontal scroll and is not working, the scroll appear but i can't scroll nothing.
The HTML code is simple:
<ion-scroll direction="x" class="box">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</ion-scroll>
and CSS:
.box {
width: 60vw;
height: 10vh;
border: 1px solid black;
}
.box > * {
display: inline-block;
margin-right: 4vw;
width: 20vw;
height: 10vh;
background: red;
}
Any suggestion? i am doing something wrong? i am missing something?
Thanks in advance
View this codepen example, edit it and change it to your style.
angular.module('ionicApp', ['ionic'])
.controller('MainCtrl', ['$scope', function($scope) {
$scope.data = {
isLoading: false
};
}]);
.wide-as-needed {
overflow: scroll;
white-space: nowrap;
}
.scroll {
min-width: 100%;
}
.bar.bar-loading {
display: block;
height: 24px;
/* starts right below a normal header */
top: 44px;
/* make the text centered vertically and horizontally */
text-align: center;
padding: 0;
line-height: 24px;
/* transition 'sliding down' (check below)*/
-webkit-transition: 200ms all;
}
/*
* make the content's top changes animate.
* might not always look good, but looks
* good when our loader is added & removed
*/
.has-header {
-webkit-transition: 200ms top;
}
.has-header.has-loading {
/* 44px (header) + 24px */
top: 68px;
}
/* make loading bar slide up/down */
.bar-loading.ng-enter,
.bar-loading.ng-leave.ng-leave-active {
height: 0;
border-width: 0px;
}
.bar-loading.ng-enter.ng-enter-active,
.bar-loading.ng-leave {
height: 24px;
border-width: 1px;
}
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Ionic Modal</title>
<link href="http://code.ionicframework.com/nightly/css/ionic.min.css" rel="stylesheet">
<script src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>
<body ng-controller="MainCtrl">
<ion-header-bar class="bar-positive">
<h1 class="title">Hello!</h1>
</ion-header-bar>
<ion-header-bar class="bar-subheader">
<ion-scroll direction="x" class="wide-as-needed">
<a class="button inline-button">this is a button : 1</a>
<a class="button">this is a button : 2</a>
<a class="button">this is a button : 3</a>
<a class="button">this is a button : 4</a>
<a class="button">this is a button : 5</a>
<a class="button">this is a button : 6</a>
<a class="button">this is a button : 7</a>
<a class="button">this is a button : 8</a>
<a class="button">this is a button : 9</a>
<a class="button">this is a button : 10</a>
<a class="button">this is a button : 11</a>
<a class="button">this is a button : 12</a>
<a class="button">this is a button : 13</a>
<a class="button">this is a button : 14</a>
<a class="button">this is a button : 15</a>
<a class="button">this is a button : 16</a>
</ion-scroll>
</ion-header-bar>
<div class="bar bar-loading bar-assertive" ng-if="data.isLoading">
Loading...
</div>
<ion-content ng-class="{'has-loading': data.isLoading}">
<ion-toggle ng-model="data.isLoading">Toggle me to toggle loading!</ion-toggle>
</ion-content>
</body>
</html>
I had the same problem- horizontal scroll worked fine on iOS but not at all on android. It seems this is a bug with ionic:
https://github.com/driftyco/ionic-v1/issues/193
I'm using ionic 1.3.2, but it looks like it's still an issue in 2.x as well.
I was able to fix it by adding adding overflow-scroll="false" to the ion-scroll element.

Resources