setting vue modal mask to blur - html

I'm trying to add a blur panel behind my modal using vue.js but The problem is that the modal-mask has the content nested in it so to add a filter: blur() property it'll blur everything.
Right now I can only add a black tint to the background.
jsfiddle: https://jsfiddle.net/EricTalv/2eed5qjo/26/
HTML
<div id="content-container">
<div id="wrapper">
<ul id="flex-container">
<li class="flex-item">
<div id="list-area"></div>
</li>
<li class="flex-item">
<div id="img-desc-container">
<div class="image-area">
<img src="http://dukes-lancaster.org/wp-content/uploads/2014/11/placeholder.jpg">
</div>
<div class="description-area"></div>
</div>
</li>
</ul>
<button class="modal-close" #click="$emit('close')">Close</button>
</div>
</div>
</div>
CSS
/* BLUR PANEL */
#modal-mask {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
display: table;
transition: opacity .3s ease;
}

you'll need to move the content into a separate container and toggle a blur class
https://jsfiddle.net/2eed5qjo/27/
<div :class="{'blur-content': showModal}">
... your content ...
</div>
<!-- use the modal component, pass in the prop -->
<modal v-if="showModal" #close="showModal = false">
</modal>
then add a css class like this
.blur-content{
filter: blur(5px);
}

Related

How to use idangero swiper with words on the background then response?

I want to make a carousel like the one on this website:
https://debut-demo.myshopify.com/
The words stick with the picture it belongs to in the carousel.
I tried to use position: relative and position: absolute to make the words on the background.
1.My HTML
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">
<h2>title01</h2>
<img src="../src/images/background1.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="../src/images/background2.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="../src/images/background3.jpg" alt="">
</div>
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- If we need scrollbar -->
<div class="swiper-scrollbar"></div>
</div>
2.My SCSS
.swiper-container {
.swiper-slide {
max-height: 700px;
position: relative;
img {
-webkit-filter: brightness(.8);
width: 100%;
}
h2 {
top: 245px;
left: 100px;
font-size: 4.0625rem;
z-index: 20;
position: absolute;
}
}
}
enter image description here
enter image description here

Multiple container next to each other in Bootstrap4

I have a bootstrap layout which I am trying to develop as a dashboard.
I have a container-fluid like this
<div class="row">
<div class="col-10 col-md-3 col-lg-3 col-sm-6">
</div>
It;s height is 100vh and width 250px. I have applied a margin-left:-240px so that it hides and when the user hovers over the 10px div the whole div shows up using transitions.
My problem is to place a main div next to it,like so
How can I achieve this? Should I add another container or row?
You can you the new auto-layout col class..
<div class="container-fluid">
<div class="row">
<div class="sidebar bg-faded">Sidebar</div>
<div class="col bg-inverse text-white">
Content
</div>
</div>
</div>
Demo: http://www.codeply.com/go/pDFygIAy9G
Not sure if you want the sidebar to push the content to its right over when it opens or if you want the sidebar to overlay the content when it opens.
Here is a solution for an overlaid sidebar.
$( '.sidebar' ).on( 'click', function ( e ) {
$( this ).toggleClass( 'closed' );
} );
#import url( 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );
.sidebar {
position: absolute;
left: 0;
top: 0;
width: 250px;
height: 100vh;
color: white;
background-color: black;
transition: left 500ms ease-in-out;
z-index: 5;
}
.sidebar.closed {
left: -240px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<aside class="sidebar closed">
<p>
Sidebar
</p>
</aside>
<div class="container-fluid">
<div class="row">
<div class="col-xs-6">
.col-md-6
</div>
<div class="col-xs-6">
.col-md-6
</div>
</div>
</div>

Bootstrap full width sections with graphical backgrounds

I am trying to implement a design from my graphic designer, which whilst looks cool is giving me some headaches as i don't know how to implement in bootstrap.
We have a call to action section, which aligns with the 12 column grid system on its left and right extremes.
It also stretches to the view-port edges:
On the left we have red background stretching all the way to the view-port edge.
On the right we have a grey background image stretching all the way to the view-port edge.
I haven't been able to find a search term for what I am looking to achieve let alone where to start (other than have the cta use the background for the entire width, then overlay a left element over the top).
Any idea on how to code the below graphical layout in bootstrap please?
<section class="cta" style="background: grey; position: relative">
<div class="red" style="position: absolute; left: 0; width: 10%; background: red"></div>
<div class="text-outer">
<div class="container">
<div class="row">
<div class="col-xs-6">left</div>
<div class="col-xs-6">right</div>
</div>
</div>
</div>
</section>
Using <div class="container-fluid"> as a starting point; I am guessing at your page's layout. Let's try this:
See below:
.cntn {
border: 1px red solid; /* you can remove this (not needed) */
}
.red {
background-color: red;
text-align: right;
margin: 0; /* optional */
width: 100px; /* adjust to suit your needs */
float: left;
}
.cta {
margin: 0; /* optional */
float: right;
border: 1px solid green; /* you can remove this (not needed) */
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- make container fluid -->
<div class="container-fluid">
<div class="row">
<!-- heading area: hexagon -->
<div class="red">
<img src="http://placehold.it/100/100" />
</div>
<!-- heading area: call-to-action -->
<section class="cta">
Action
</section>
</div>
<div class="row cntn">
<div class="col-xs-6">left</div>
<div class="col-xs-6">right</div>
</div>
</div>
Simply change 'div class="container"' to 'div class="container-fluid"'
Something like this? Where black should be the grey gradient and max-width:400px could be anything.
.cta {
overflow-x: hidden;
position: relative
}
.text-outer .container {
width: 100%;
max-width: 400px;
background: grey;
z-index: 2;
position: relative;
}
.text-outer:before,
.text-outer:after {
content: "";
position: absolute;
width: 50%;
height: 100%;
top: 0;
}
.text-outer:before {
background-color: red;
left: 0;
}
.text-outer:after {
background-color: black;
right: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<section class="cta">
<div class="text-outer">
<div class="container">
<div class="row">
<div class="col-xs-6">left</div>
<div class="col-xs-6">right</div>
</div>
</div>
</div>
</section>
jsFiddleLink
I created with 3 divs as Left Center and Right but if you want to use Left and center then create your own class. Probably following will work
.custom {
width:calc(100% - (50% - 768px/2));
}
.custom {
width:calc(100% - leftCellWidth);
}
You can set height of left as per height of hex image.
Use jumbotron class outside the class container for full-width, as explained here.
HTML:
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="red col-xs-4">
</div>
<div class="grey col-xs-8">
</div>
</div
</div>
</div>
CSS:
.red {
background: url('awesomeredimage.png');
background-size: cover;
}
.grey {
background: url('awesomegreyimage.png');
background-size: cover;
}
All your divs should be wrapped in the container div. And as some others have also suggested: container-fluid helps.
Within container fluid you can add a regular container for the rest of your content. My code below explains this.
You could take the easy route and just use the entire cta image you've posted as a clickable image with .img-responsive in a col-xs-12. In that case my fix takes you about 2 minutes:
<section style="background: grey; position: relative">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<img src="/img/cta.jpg" class="img-responsive">
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="container">
<!-- All you other content here-->
</div>
</div>
</div>
</div>
</section>
But you could also hack the design into cols, as I try to show in the code snippet below. Of course you need to tweak and decide on the exact sizes yourself.
<section style="background: grey; position: relative">
<div class="container-fluid">
<div class="row">
<div class="col-xs-3 red">
<img src="/img/hexagon.png" class="img-responsive pull-right">
<!--and give this img a negative margin to flow over to the grey area-->
</div>
<div class="col-xs-1 grey-image"></div>
<div class="col-xs-3 grey-image">
<h3 class="text-center">Call to action</h3>
<p class="text-center">Discount etcetera</p>
</div>
<div class="col-xs-5 grey-image">
<button class="btn center-block">Request quote</button>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="container">
<!-- All you other content here-->
</div>
</div>
</div>
</div>
</section>
Use class="container-fluid" instead of class="container" and than do this style:
.container-fluid {
margin-right: auto;
margin-left: auto;
padding-left: 0px;
padding-right: 0px;
}

Positioning overlay over image

Problem
I'm trying to position an color block/overlay background: rgba(34, 34, 34, 0.73); on top of an image when it is hovered over.
Tried using z-index to push the overlay to the front as it seems to be sitting behind the image, while I have a feeling that my positioning position: relative may be the problem, changing it to position: absolute has made the overlay jump way out of position.
I've looked into the previously posed questions and haven't had too much luck.
Github repo for Angular project: https://github.com/onlyandrewn/angular
home.html
---
name: home
url: /
---
<div ng-controller="MainCtrl">
<header>
<p class="sponsored" id="top">Sponsored by </p>
<img src="http://placehold.it/200x30" class="sponsors" alt="">
<h1>Business Directory</h1>
<div class="find">
<input type="search" placeholder="What are you looking for?" ng-model="query">
</div><!-- /.find -->
</header>
<div class="businesses">
<div class="storeIcon">
<img src="/assets/img/store.png" class="store" alt="">
</div><!-- /.storeIcon -->
<p class="number">Search {{businesses.length}} businesses in Brandon</p><button class="filter button">Filter by <i class="fa fa-chevron-down"></i></button>
<div class="options">
<div class="cat">
<div class="categories">
<div class="group">
<p class="name">Grade Level</p>
<div class="check">
<input type="radio" name=""><p>Auto</p>
<input type="checkbox" name=""><p>Restaurant</p>
<input type="checkbox" name=""><p>Other</p>
</div><!-- /.check -->
</div><!-- /.group -->
<div class="group">
<p class="name">School Type</p>
<div class="check">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
</div><!-- /.check -->
</div><!-- /.group -->
</div><!-- /.categories -->
</div><!-- /.cat -->
</div><!-- /.options -->
</div><!-- /.businesses -->
<div class="all">
<div class="business large-4.columns" data-ng-repeat="business in businesses | filter:query | orderBy:'name'" >
<div class="overlay">
<img src="http://placehold.it/300x300" class="storefront" alt="">
</div><!-- /.overlay -->
<div class="info">
<p class="name">{{business.name}}</p>
<p class="description">{{business.description}}</p>
<p class="address">{{business.address}}</p>
{{business.website}}
</div><!-- /.info -->
</div>
</div>
<footer>
<hr>
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<div class="backContainer">
<p class="back">Back to top</p>
</div><!-- /.backContainer -->
</footer>
</div>
custom.scss (Code snippet, for brevity)
/*----------------------------------
OVERLAYS
----------------------------------*/
.overlay {
background: rgba(34, 34, 34, 0.73);
position: relative;
width: 300px;
height: 300px;
border: 1px solid red;
opacity: 0;
&:hover {
opacity: 1;
}
}
.storefront {
position: relative;
}
Take a look at this, I've done a little example which shows you how to do an overlay in CSS. Hope this helps you out.
If you want to add an image instead of just changing the opacity or overlaying with colour. Just add this line into the #overlay:hover
background-image: url("imagePath");
Also remove the opacity, as you don't need to change the opacity if you want to use a image
Example:
div { position: relative; float: left; }
img { display: block; }
#background { background: red; }
#background:hover img { opacity: 0.5; }
#overlay span {
background: red;
bottom: 0;
display: block;
left: 0;
opacity: 0;
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
#overlay:hover span { opacity: 0.5; }
<!-- Uses background color to fade color from behind. -->
<div id="background">
<img src="http://lorempixel.com/100/100/food" height="100" width="100" />
</div>
<!-- Uses empty span to overlay color. -->
<div id="overlay">
<span></span>
<div>
You can achieve what you want without changing your markup:
.overlay {
position: relative;
width: 300px;
height: 300px;
}
.overlay:hover:after {
content: '';
width: 100%;
height: 100%;
background: rgba(34, 34, 34, 0.73);
position: absolute;
left: 0;
}
<div class="overlay">
<img src="http://placehold.it/300x300" class="storefront" alt="" />
</div><!-- /.overlay -->
The reason your current overlay doesn't work is because your image is a child element of overlay. You can think of the img element as sitting on top of it's parent (.overlay). It isn't possible for the parent to sit on top of its child elements.

Hovers and Fading

I hope you can help me. I'm working on my new portfolio website and need a bit of help on hover effects in work showcase section. I'm not good developer so excuse me if my code sux x), I do design mostly. And ye, i used Bootstrap 3.0 as my framework.
// Here is the HTML code //
<div class="portfolio" id="portfolio"> <!-- portfolio begin -->
/unimportant stuff...../
<div class="container my-creations">
<div class="row">
<div class="col-md-3">
<a href="#">
<div class="circle">
<img src="img/gmedia.png" alt="" id="gmedia" width="115" height="115">
</div>
</a>
</div>
<div class="col-md-3">
<a href="#">
<div class="circle">
<img src="img/ginc.png" alt="" id="ginc" width="136" height="114">
</div>
</a>
</div>
<div class="col-md-3">
<a href="#">
<div class="circle">
<img src="img/fgeeks.png" alt="" id="fgeeks" width="107" height="115">
</div>
</a>
</div>
<div class="col-md-3">
<a href="#">
<div class="circle">
<img src="img/weboxit.png" alt="" id="wbx" width="115" height="115">
</div>
</a>
</div>
</div> <!-- end of row -->
</div> <!-- end of my-creations -->
</div> <!-- end of portfolio -->
//And here is the following CSS//
.portfolio {height: 100%;}
.my-creations {margin-top: 60px;}
.circle {
width: 270px;
height: 270px;
line-height: 270px;
border-radius: 1000000px;
background-color: #262d30;
border: 8px solid #2c3235;
text-align: center;
background-image: url('img/gmedia.png') no-repeat;}
.circle img {
vertical-align: middle;
display: inline-block;
margin-bottom: 15px;
filter: url(filters.svg#grayscale); /* Firefox */
filter: gray; /* IE */
-webkit-filter: grayscale(1); /* Webkit */ }
#ginc {margin-bottom: 30px;}
.circle img:hover {
filter: none;
-webkit-filter: grayscale(0);}
And here are my questions:
Is there a way when hover .circle that my img changes filter?
And how can I apply fade hover on img? So that it slowly goes from black and white to colorful image. ---- ANSWERED, THANKS bboysupaman and JoshC!
I hope you can help me, and if you need more info, just ask.
You can use CSS transitions!
Add the following to your css. =)
.circle img
{
transition: all 2s;
-webkit-transition: all 2s;
}
.circle:hover img {
opacity:.5;
}
On the other hand, you can use Jquery to make animation. I am pretty sure that Twitter-bootstrap comes Jquery code too.
However, if you are worried about performance, you can stick with css3.
HTML Code:
<div class="circle1">
<img src="http://upload.wikimedia.org/wikipedia/commons/0/0e/Ski_trail_rating_symbol-green_circle.svg"
width="80px" height="80px" />
</div>
Jquery Code:
$(document).ready(function () {
$(".circle1").mouseenter(
function () {
$(".circle1").fadeOut();
});
$(".circle1").mouseleave(
function () {
$(".circle1").fadeIn();
});
});
Here is an example of jsfiddle.
http://jsfiddle.net/7MV6Q/