the header shakes/tremble when I scroll - jQuery Scrolling problem - javascript

I'm completely blocked, I don't understand why the header shakes/tremble when I scroll with this jquery script
$(window).scroll(function() {
if ($(this).scrollTop() >= 100) {
$(".logo").css({ "height": "0px" });
$(".logo img").hide();
};
if ($(this).scrollTop() <= 100) {
$(".logo").css({
"height": "95px",
"-webkit-transition": "all 0.3s ease",
"-moz-transition": "all 0.3s ease",
"-ms-transition": "all 0.3s ease",
"-o-transition": "all 0.3s ease",
"transition": "all 0.3s ease"
});
$(".logo img").fadeIn();
}
});
this is the html file content
<header class="d-flex justify-content-end sticky-top">
<div class="container">
<div class="row logo">
<div class="col-12 text-center mt-2">
<img src="/images/logo.png" alt="Logo">
</div>
</div>
<div class="row">
<div class="col-12">
<nav class="navbar navbar-expand-lg navbar-light">
</nav>
</div>
</div>
</div>
</header>
Can anyone help find why?

Already fixed!!!
As you can see I was using the sticky-top bootstrap class for header tag, this class apply position:sticky; property.
This cause the jquery detects that when the scrollTop was greater than 100 the div of the logo image changed its height therefore the scrollTop was again less than 100 and the div reappeared and remained in that game!
I just change to position:fixed; and the scrolling starts to work correctly.

Instead of adding the CSS transition using JS, create a class and use jquery functions addClass and removeClass
$(window).scroll(function() {
if ($(this).scrollTop() >= 100) {
$(".logo").removeClass('effect');
$(".logo img").fadeOut();
};
if ($(this).scrollTop() <= 100) {
$(".logo").addClass('effect');
$(".logo img").fadeIn();
}
});
* {
margin: 0;
padding: 0;
}
.container {
height: 1000px;
}
.logo {
top: 2px;
left: 5px;
position: sticky;
height: 95px;
width: 95px;
overflow: hidden;
}
.logo img {
height: 100%;
}
.effect {
height: 95px;
transition: linear 0.3s ease;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<div class="container">
<div class="logo">
<img src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png" />
</div>
</div>

Related

NavBar Transition CSS Trouble

I have a Navbar which makes a transition when I scroll down.
When I scroll up, the transition doesn't work and I don't know why. Can someone help me resolve this?
The JS code is adding the scrolled class when Math.round($(window).scrollTop()) > 100.
#supports (position: sticky) {
body {
padding-top: 0;
}
header {
position: sticky;
}
}
.scrolled {
transition: 0.5s ease;
}
.scrolled.header {
height: 50px;
background-color: rgba(0, 0, 0, 0.8);
transition: 0.5s ease;
}
.scrolled.header .header-menu {
line-height: 40px;
transition: 0.5s ease;
}
<div class="block">
<header class="header">
<i class="fas fa-signal"></i>NAME
<nav class="header-menu">
Accueil
Compétences
Parcours
Projets
Hobbies
Contact
</nav>
<a href="#" class="toggle" id="burgerButton">
<i class="fas fa-bars"></i>
</a>
</header>
</div>
If I understand correctly : When you scroll down you add the .scrolled class, and when you move up you remove it ?
If so, you should also add the transition : 0.5s ease; to the nav-bar itself. Because when you remove the .scrolled class, why would a transition occure if the nav haven't this specified in it's css ?

Changing box-shadow of css using javascript on scroll

my css of my bootstrap nav is as follows
.navbar-default
{
background-color: #fff;
box-shadow: 5px -149px 90px 200px rgba(255,255,255,1);
border-color: #fff;
height:0px;
padding: 0px;
border: 0px;
}
and in my js file i am calling this function using jquery
$(window).scroll(function(){
var wScroll = $(this).scrollTop();
if (wScroll==500)
{
$('.navbar-default').attr("box-shadow","5px -49px 190px 220px rgba(255,255,255,1)");
}
console.log(wScroll);
});
what i want is to change my box-shadow after scrolling about 500px but it is not happening
help me with this please?
Change if (wScroll==500) to if (wScroll>=500)
and $('.navbar-default').attr to $('.navbar-default').css.
$(window).scroll(function(){
var wScroll = $(this).scrollTop();
if (wScroll>=500)
{
$('.navbar-default').css("box-shadow","5px -49px 190px 220px rgba(255,255,255,1)");
}
});
Edit: For ease effect use trasition:
.navbar-default {
transition: ease .5s;
-webkit-transition: ease .5s;
}
Try this sample
$('.navbar-default').css("box-shadow", "rgb(121, 122, 195) 0px 5px 5px 5px")
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="#" class="navbar-brand"> <img alt="Brand" height="20" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAB+0lEQVR4AcyYg5LkUBhG+1X2PdZGaW3btm3btm3bHttWrPomd1r/2Jn/VJ02TpxcH4CQ/dsuazWgzbIdrm9dZVd4pBz4zx2igTaFHrhvjneVXNHCSqIlFEjiwMyyyOBilRgGSqLNF1jnwNQdIvAt48C3IlBmHCiLQHC2zoHDu6zG1iXn6+y62ScxY9AODO6w0pvAqf23oSE4joOfH6OxfMoRnoGUm+de8wykbFt6wZtA07QwtNOqKh3ZbS3Wzz2F+1c/QJY0UCJ/J3kXWJfv7VhxCRRV1jGw7XI+gcO7rEFFRvdYxydwcPsVsC0bQdKScngt4iUTD4Fy/8p7PoHzRu1DclwmgmiqgUXjD3oTKHbAt869qdJ7l98jNTEblPTkXMwetpvnftA0LLHb4X8kiY9Kx6Q+W7wJtG0HR7fdrtYz+x7iya0vkEtUULIzCjC21wY+W/GYXusRH5kGytWTLxgEEhePPwhKYb7EK3BQuxWwTBuUkd3X8goUn6fMHLyTT+DCsQdAEXNzSMeVPAJHdF2DmH8poCREp3uwm7HsGq9J9q69iuunX6EgrwQVObjpBt8z6rdPfvE8kiiyhsvHnomrQx6BxYUyYiNS8f75H1w4/ISepDZLoDhNJ9cdNUquhRsv+6EP9oNH7Iff2A9g8h8CLt1gH0Qf9NMQAFnO60BJFQe0AAAAAElFTkSuQmCC"
width="20"> </a>
</div>
</div>
</nav>
</div>
</div>
</div>
I hope to have helped in some way

Inconsistent CSS being applied through JavaScript

I am having an issue with a page I am developing; it seems the CSS that is being generated by my JavaScript file is inconsistent. It seems to be only the CSS regarding the placement of a div (using calculated values) and the height of a couple other divs (also using calculated values).
This was not an issue until I deployed to the hosting service for ongoing development testing. In other words, on my local machine, the issue is not reproducible.
I have had to refresh the page as many as 40 times to get reproduce the issue, but it happens...
The inconsistent behavior is regarding the placement of the <article class="betterThings">. The placement is calculated by JS, and it seems that JS is not always calculating the $('.header').outerHeight() correctly. Again, it works most of the time, but not always. I should also specify that I have only been able to reproduce in Chrome so far.
Website here
Code here:
var navTop;
var windowHeight;
var belowHeader;
var tallestHomeDiv;
var orientation = window.orientation;
$('document').ready(function() {
navTop = $('.header').outerHeight(true);
windowHeight = $(window).height();
belowHeader = ((windowHeight - (navTop + 50)));
tallestHomeDiv = $('.dislike').outerHeight(true);
placeElements();
stickyNav();
showBetterThings();
});
function stickyNav() {
$('.navbar').affix({offset: {top: navTop} });
}
function placeElements() {
$('article.betterThings').css('position', 'absolute');
$('article.betterThings').css('top', belowHeader / 2);
$('article.betterThings').css('transform', 'translateY(-50%)');
$('article.balance').css('margin-top', belowHeader);
$('article.balance').css('height', tallestHomeDiv);
$('article.busy').css('margin-top', belowHeader);
$('article.busy').css('height', tallestHomeDiv);
$('article.dislike').css('margin-top', belowHeader);
}
function showBetterThings() {
$('article.betterThings').addClass('show');
}
/****************************************
GLOBAL STYLES
****************************************/
/*=-=-=-=-=-=-= header =-=-=-=-=-=-=-=-=*/
.header {
background-color: #323232;
}
.fullLogo {
padding: 1%;
margin: 0 auto;
}
/*=-=-=-=-=-=-= navigation -=-=-=-=-=-=-=*/
.navCont {
min-height: 50px;
}
.navbar {
border-radius: 0;
margin: 0;
background-color: #316924;
-webkit-transition: all 1s ease-in;
-moz-transition: all 1.5s ease-in;
-ms-transition: all 1.5s ease-in;
-o-transition: all 1.5s ease-in;
transition: all 1.5s ease-in;
}
.navbar.affix {
top: 0;
width: 100%;
z-index: 100;
background-color: #323232;
-webkit-transition: all 1.5s ease-in;
-moz-transition: all 1.5s ease-in;
-ms-transition: all 1.5s ease-in;
-o-transition: all 1.5s ease-in;
transition: all 1.5s ease-in;
}
.navbar > .container-fluid > .navbar-collapse > .navbar-nav > .active > a {
background-color: #323232;
}
.navbar.affix > .container-fluid > .navbar-collapse > .navbar-nav > .active > a {
background-color: #316924;
}
.houseLogo {
height: 45px;
margin-top: -13px;
}
/*=-=-=-=-=-=-=-=- body =-=-=-=-=-=-=-=-=*/
section.content {
}
h1.home, h2.home {
font-family: 'Kaushan Script', cursive;
color: #b30047;
text-align: center;
}
p.home {
color: #5dd9d5;
}
a.home.scroll {
color: #b30047;
font-size: .75em;
}
article.home {
background-color: rgba(0, 0, 0, .5);
font-size: 1.25em;
padding: 25px;
border-radius: 10px;
}
article.betterThings {
margin-right: 8.33333%;
text-align: center;
opacity: 0;
}
article.betterThings.show {
opacity: 1;
-webkit-transition: opacity 5s ease-in-out;
-moz-transition: opacity 5s ease-in-out;
-ms-transition: opacity 5s ease-in-out;
-o-transition: opacity 5s ease-in-out;
transition: opacity 5s ease-in-out;
}
div.first {
padding-left: 0;
}
div.last {
padding-right: 0;
}
.homeBackVideo {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
transform: translateX(-50%) translateY(-50%);
opacity: 0.5;
}
.content {
height: 1000px;
}
.aside {
}
/*=-=-=-=-=-=-=-= footer -=-=-=-=-=-=-=-=*/
.footer {
background-color: black;
width: 100%;
margin-top: 50px;
padding: 0;
}
.footerContact {
margin: 15px;
height: 2em;
}
/*****************************************
MEDIA QUERIES
******************************************/
/*=-=-=-=-=-= for mobile only =-=-=-=-=-=*/
#media only screen and (max-width: 767px) {
.navbar > div.container-fluid > div.navbar-header > a.navbar-brand {
opacity: 0;
-webkit-transition: all 0.75s ease-in;
-moz-transition: all 0.75s ease-in;
-ms-transition: all 0.75s ease-in;
-o-transition: all 0.75s ease-in;
transition: all 0.75s ease-in;
}
.navbar.affix > div.container-fluid > div.navbar-header > a.navbar-brand {
opacity: 1;
-webkit-transition: all 0.75s ease-in;
-moz-transition: all 0.75s ease-in;
-ms-transition: all 0.75s ease-in;
-o-transition: all 0.75s ease-in;
transition: all 0.75s ease-in;
}
}
/*=-=-=-=-=-for tablet and below=-=-=-=-=*/
#media only screen and (max-width: 991px) {
div.first, div.middle, div.last {
padding: 0;
}
article.busy, article.dislike {
margin-top: 25px !important;
}
}
/*=-=-=-=-=-= for tablet only =-=-=-=-=-=*/
#media only screen and (min-width: 768px) and (max-width: 991px) {
}
/*=-=-=-=-= for tablet and above =-=-=-=-*/
#media only screen and (min-width: 768px) {
.navbar > div.container-fluid > div.navbar-header {
width: 0;
overflow: hidden;
-webkit-transition: all 0.75s ease-in-out;
-moz-transition: all 0.75s ease-in-out;
-ms-transition: all 0.75s ease-in-out;
-o-transition: all 0.75s ease-in-out;
transition: all 0.75s ease-in-out;
}
.navbar.affix > div.container-fluid > div.navbar-header {
padding: 0px;
width: 190px;
-webkit-transition: all 0.75s ease-in-out;
-moz-transition: all 0.75s ease-in-out;
-ms-transition: all 0.75s ease-in-out;
-o-transition: all 0.75s ease-in-out;
transition: all 0.75s ease-in-out;
}
}
/*=-=-=-=-=- for desktop only =-=-=-=-=-=*/
#media only screen and (min-width: 992px) {
h1.home {
font-size: 3em;
margin-bottom: .75em;
}
}
<!DOCTYPE html>
<html>
<head>
<title>
</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kaushan+Script">
<link rel="stylesheet" href="./css/styles.css">
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script defer src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script defer src="./scripts/kelliKlean.js"></script>
</head>
<body>
<div class="container-fluid mainContainer">
<!--=-= HEADER =-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<div class="row">
<header class="header col-xs-12">
<img class="img-responsive fullLogo" src="./resources/fullLogo.png" alt="full logo"/>
</header>
</div>
<!--=-= NAV BAR -==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<div class="row navCont">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><img class="img-responsive houseLogo" src="./resources/navLogo.png" alt="full logo"/></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><span class="glyphicon glyphicon-usd"></span> Quote</li>
<li><span class="glyphicon glyphicon-map-marker"></span> Map</li>
</ul>
</div>
</div>
</nav>
</div>
<!--=-= CONTENT -==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<div class="row">
<!---- backgroung video --------------------------------------------------------------------->
<video loop muted autoplay class="homeBackVideo">
<source src="./resources/beach.mp4" type="video/mp4">
</video>
<section class="content col-xs-12">
<div class="row">
<article class="home betterThings col-xs-10 col-xs-offset-1">
<h1 class="home">Because you have better things to do!</h1>
<p class="home">Wouldn't you rather drive to the beach and spend your Saturday basking in the warmth
of the sun and cooling off in the shallow, salty water of the Gulf instead of cleaning
your home? Life is short, enjoy it!</p>
<a class="home scroll btn btn-default" href="#">Scroll Down<br>
<span class="home glyphicon glyphicon-menu-down"></span>
</a>
</article>
</div>
<div class="row">
<div class="first col-xs-10 col-xs-offset-1 col-md-3">
<article class="home balance">
<img class="balance img-responsive" src="./resources/balance.jpg"/>
<h2 class="home balance">It's All About Balance</h2>
<p class="home">After a long day at work, the last thing you want to worry about is cleaning your
home, not to mention that it depletes valuable time that you could be enjoying other activities.
Even if you don't need a daily housekeeper, having a scheduled cleaning a couple times a month
will help balance the scales between work and life. Remember, we work to live, we don't live to
work!</p>
</article>
</div>
<div class="middle col-xs-10 col-xs-offset-1 col-md-offset-0 col-md-4">
<article class="home busy">
<img class="busy img-responsive" src="./resources/busy.jpg"/>
<h2 class="home busy">Who Has the Time?</h2>
<p class="home">If your schedule is already packed full, finding the time to clean is never easy.
Between dropping the kids off, driving to work, cooking dinner, and walking the dog, who has
the time to clean? Studies have shown conflict among busy families can often come from the
stress of finding (or spending) time to clean. Hiring a housekeeper can help lower your stress
level by allowing you to fit in everything else your busy days have to offer. </p>
</article>
</div>
<div class="last col-xs-10 col-xs-offset-1 col-md-offset-0 col-md-3">
<article class="home dislike">
<img class="balance img-responsive" src="./resources/dislike.jpg"/>
<h2 class="home balance">Please NO!</h2>
<p class="home">If you are like most people, in lieu of cleaning you would rather be doing... well,
anything! Let's face it: cleaning is not the most desirable way to spend your time. Also, some people
are just better at cleaning that others. If it takes you hours to clean your home and you hate every
minute of it, why not hire someone that would do it faster so you can devote your time to
whatever it is you would rather be doing?</p>
</article>
</div>
</div>
<!--=-= FOOTER =-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
<div class="row">
<footer class="footer col-xs-12">
<img class="footerContact" src="./resources/facebook.png"/>
<img class="footerContact" src="./resources/email.png"/>
<img class="footerContact" src="./resources/call.png"/>
</footer>
</div>
</section>
</div>
</div>
</body>
</html>
It seems to me that the problem is that your code for retrieving the height of the highest div happens before the images on the page are loaded, making the highest div quite low.
It could be solved by executing the code on window.load rather than document.ready, but please consider a more elegant solution (I would try to look up if bootstrap does not support this)
As Jakub suggested, I looked into boostrap functionality to support what I was trying to accomplish. It turns out using the built in .card class in bootstrap will achieve what I wanted. I can create a deck of card that will all have the same height and eliminate the need for the dynamically calculated values in javascript.

Hover div another div appear on top

I'm creating something like this. When I hover the buttons upper content will change but each buttons have different content.
But I cannot see the content when hovering it :(
Does anybody know how to fix it? or is there any jquery fix?
Thanks in advance
#service-content {
display: none;
opacity: 1;
height: 200px;
-webkit-animation: flash 1.5s;
animation: flash 1.5s;
}
#-webkit-keyframes flash {
0% {
opacity: .4;
}
100% {
opacity: 1;
}
}
#keyframes flash {
0% {
opacity: .4;
}
100% {
opacity: 1;
}
}
#home-button-1:hover~#service-content .construction-neuve,
#home-button-2:hover~#service-content .renovation-residentiel,
#home-button-3:hover~#service-content .service-de-plan-et-design,
#home-button-4:hover~#service-content .entrepreneur-commercial,
#home-button-5:hover~#service-content .apres-sinistre,
#home-button-6:hover~#service-content .decontamination-d-amiante
{
display: block;
opacity: 1;
-webkit-animation: flash 1.5s;
animation: flash 1.5s;
}
#slider-buttons .span4 {
width: 383px;
float:left;
height:50px;
}
#slider-buttons .image-content {
position: relative;
}
#slider-buttons .image-caption {
background: #000000 none repeat scroll 0 0;
bottom: 0;
color: #6e6e6e;
padding: 10px 0;
position: absolute;
text-align: center;
text-transform: uppercase;
width: 383px;
font-weight: 600;
}
#slider-buttons .image-caption:hover {
background: #ba9444 none repeat scroll 0 0;
bottom: 0;
color: #000000;
padding: 10px 0;
position: absolute;
text-align: center;
text-transform: uppercase;
width: 383px;
font-weight: 600;
cursor: pointer;
}
<div id="service-content">
<div class="construction-neuve">
content
</div>
<div class="renovation-residentiel">
content
</div>
<div class="service-de-plan-et-design">
content
</div>
<div class="entrepreneur-commercial">
content
</div>
<div class="apres-sinistre">
content
</div>
<div class="decontamination-d-amiante">
content
</div>
</div>
<div id="slider-buttons" class="span12">
<div id="construction-neuve" class="span4 m-l00">
<div class="image-content">
<img src="images/home-buttons/home-button-1.jpg">
<div id="home-button-1" class="image-caption">Construction Neuve</div>
</div>
</div>
<div id="renovation-residentiel" class="span4 m-l10">
<div class="image-content">
<img src="images/home-buttons/home-button-2.jpg">
<div id="home-button-2" class="image-caption">Rénovation Résidentiel</div>
</div>
</div>
<div id="service-de-plan-et-design" class="span4 m-l10">
<div class="image-content">
<img src="images/home-buttons/home-button-3.jpg">
<div id="home-button-3" class="image-caption">Service de plan et design</div>
</div>
</div>
<div id="entrepreneur-commercial" class="span4 m-l00">
<div class="image-content">
<img src="images/home-buttons/home-button-4.jpg">
<div id="home-button-4" class="image-caption">Entrepreneur Commercial</div>
</div>
</div>
<div id="apres-sinistre" class="span4 m-l10">
<div class="image-content">
<img src="images/home-buttons/home-button-5.jpg">
<div id="home-button-5" class="image-caption">Aprés-Sinistre</div>
</div>
</div>
<div id="decontamination-d-amiante" class="span4 m-l10">
<div class="image-content">
<img src="images/home-buttons/home-button-6.jpg">
<div id="home-button-6" class="image-caption">Décontamination d'amiante</div>
</div>
</div>
</div>
It can be done using JQuery.
First, each part that should be hovered must have an onmouseover attribute that the first parameter of that should be a unique number. like this:
<div onmouseover="run_hover(1);"></div>
<div onmouseover="run_hover(2);"></div>
<div onmouseover="run_hover(3);"></div>
and each big part that will be shown should have a unique ID with a number that is the same with the parameter you entered for the div that should be hovered. Like this:
<div id="box_for_show">
<div id="div_1">Content 1</div>
<div id="div_2">Content 2</div>
<div id="div_3">Content 3</div>
</div>
and this is the JQuery code of that:
function run_hover(id) {
$("#box_for_show div").fadeOut(function(){
$("#div_"+id).fadeIn();
});
}
Point: #box_for_show div {display: none;}
Here is the fiddle that will work for you:
http://jsfiddle.net/h0puq1Ld/4/
It is not the best example but i hope it helps. You could also use list
$('div.image-caption').hover(function(){
var nums = $(this).attr('id');
$('#cont-'+nums).css('display','block');
}, function() {
$('.cont').hide();
});

Fading between images in a carousel

I've been trying to understand why my carousel won't fade between transitions. It cycles as expected, but don't seem to apply the transition effect to make one panel fade in to the next.
Here's what I have so far:
/* Javascript */
function cycle() {
var active = $('.carousel .item.active');
var panels = $('.carousel .item');
var pos = panels.index(active);
var next = panels.eq((pos >= 5) ? 0 : ++pos);
next.addClass('active');
active.removeClass('active');
}
var interval = setInterval(cycle, 2000);
/* CSS */
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
}
.carousel .item {
-webkit-transition: opacity 0.6s ease-in-out;
-moz-transition: opacity 0.6s ease-in-out;
-o-transition: opacity 0.6s ease-in-out;
transition: opacity 0.6s ease-in-out;
opacity: 0;
}
.carousel .item.active {
opacity: 1;
}
/* HTML */
<div id="id_landing_carousel" class="carousel slide">
<div class="carousel-inner">
<div class="item" data-nav-button="nav-home">
<img src="/media/carousel/home.png">
<div class="carousel-caption">
<h4><p>Welcome</p></h4>
</div>
</div>
<div class="item" data-nav-button="nav-residential">
<img src="/media/carousel/residential.jpg">
<div class="carousel-caption">
<h4><p>Residential</p></h4>
</div>
</div>
<div class="item" data-nav-button="nav-commercial">
<img src="/media/carousel/commercial.jpg">
<div class="carousel-caption">
<h4><p>Commercial</p></h4>
</div>
</div>
<div class="item" data-nav-button="nav-service">
<img src="/media/carousel/service.jpg">
<div class="carousel-caption">
<h4><p>Service</p></h4>
</div>
</div>
<div class="item active" data-nav-button="nav-blog">
<img src="/media/carousel/blog.jpg">
<div class="carousel-caption">
<h4><p>Blog</p></h4>
</div>
</div>
<div class="item" data-nav-button="nav-contact">
<img src="/media/carousel/contact.jpg">
<div class="carousel-caption">
<h4><p>Contact us</p></h4>
</div>
</div>
</div>
</div>
If anyone has any insight in to what I"m doing wrong, I'd very much appreciate it.
Damn. Nevermind. Solved it myself. Another style was setting the carousel's div element to display: none when it wasn't active.

Categories