how to make a responsive height for img in firefox (safari, chrome working) - media-queries

I have a problem here
The problem area is two images on the right side of this website using max-height:50%; is not working in Firefox.
Open the page in Chrome or Safari and it works but then open it in Firefox and it does not work.
I have tried changing the div id=rightcontent to % width, but still not working.
#total #content {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -108px; /* the bottom margin is the negative value of the footer's height
*/
}
#total #content #leftcontent {
position:relative;
width:60%;
padding-left:10%;
float:left;
}
#total #content #rightcontent {
position:relative;
max-width:237px;
float:right;
}
#total #content #rightcontent img {
position:relative;
max-height:50% !important;
float:right;
max-width:100% !important;
}
And HTML:
<div id="content">
<div id="leftcontent">
<h1>Kola <strong>STEVENS</strong> nejen prodáváme,<br/>ale hlavně na nich jezdíme.</h1>
<p></p>
</div>
<div id="rightcontent">
<div id="tst">
<img src="img/right1.png" />
<img src="img/right2.png" />
</div>
</div>
</div>

I found some similar questions like this one and I think it's a firefox way of handleing image sizes.
Your code is okay but if I was writing the code, I would use an image-wrapper for images to make it browsers cross-compatible. If you resize the page after loading in chrome you can see your images are no longer looking like before.
My solution (fiddle):
<div id="rightcontent">
<div id="tst">
<div class="image-holder">
<img src="img/right1.png" />
</div>
<div class="image-holder">
<img src="img/right2.png" />
</div>
</div>
</div>

Related

Swiper.js Forced Reflow performance issues when responsive

A question about using swiper.js carousel/slider gallery. I'm getting bad performance issues with "forced reflow" when making the slider responsive.
If the viewport is resized then the forced reflow is extreme. How do I go about debugging this?
Swiper github says this is the best place for asking for support.
I've added example code here.
Codepen
// Just duplicating swiper 20 times
const listing = document.getElementsByClassName("listing")[0];
for (let i = 0; i < 19; i++) {
let clone = listing.cloneNode(true);
clone.getElementsByClassName("swiper-container")[0].id = `carousel-${i+1}`;
document.getElementsByClassName("grid")[0].appendChild(clone);
newSwiper(i + 1);
}
function newSwiper(i) {
let swiper = new Swiper(`#carousel-${i}`, {
initialSlide: Math.floor(Math.random() * 6),
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
}
#import url('https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.1/css/swiper.min.css');
.grid {
display: grid;
grid-gap: 0.5rem;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.swiper-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.listing {
background: orange;
width: 100%;
position: relative;
}
.listing::before {
content: "";
display: inline-block;
width: 1px;
height: 0;
padding-bottom: 70%;
}
img {
height: 100%;
width: 100%;
object-fit: cover;
}
<div class="grid">
<div class="listing">
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="https://i.imgur.com/8aoOSaob.jpg" alt="thumb">
</div>
<div class="swiper-slide">
<img src="https://i.imgur.com/FB5IGMgb.jpg" alt="thumb">
</div>
<div class="swiper-slide">
<img src="https://i.imgur.com/GBpr1JR.png" alt="thumb">
</div>
<div class="swiper-slide">
<img src="https://i.imgur.com/UYqiudHb.jpg" alt="thumb">
</div>
<div class="swiper-slide">
<img src="https://i.imgur.com/BBFBbuA.jpeg" alt="thumb">
</div>
<div class="swiper-slide">
<img src="https://i.imgur.com/tpZvfRn.jpg" alt="thumb">
</div>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.1/js/swiper.min.js"></script>
I spent way too much time trying to fix this problem. Playing with the css over and over. I've come to the conclusion it's swiper.js. Perhaps how things are recalculated somewhere.
I switched the code over the glide.js and no performance problems. There's no lazy loading included so more development time needed to plug that gap.

Bootstrap tooltip opens and closes repeatedly

I have a bootstrap tooltip which I have custom styled. There seems to be an issue with it. Whenever we hover over it, it opens and then immediately closes.
HTML -
<div class="container" style="padding-top:300px">
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" data-html="true" title="" data-original-title="Tooltip Text">i</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" data-html="true" title="" data-original-title="Tooltip Text">i</span>
</div>
</div>
Here's an inline link to jsFiddle
UPDATED
I made a few changes. Try this: https://jsfiddle.net/2h7jbt9n/6/
HTML
<div class="container" style="padding-top:30px">
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" title="YoHo Ho Ho" data-placement="top" data-toggle="tooltip">i</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" title="YoHo Ho Ho" data-placement="top" data-toggle="tooltip">i</span>
</div>
</div>
JS
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip({
container: '.info-circle'
});
});
The issue was with padding for the info-circle. I wrapped it in a container. It doesn't flicker now.
Hope it helps.
You are no longer using the tooltip-arrow as the visual arrow you are using the :before and :after after as the visual arrow. The problem is that you have made the arrow bigger and made your own triangles. When you make your css arrow you are using borders. You have set your top border colors to white and blue to make it seem like the arrow has a border as well. In doing this you have forgotten that your arrow still has a bottom transparent border and this transparent border is covering up the element that you are hovering over to deploy the tooltip. So set your :before and :after psuedo elements for your .tooltip-arrow to have a bottom border of none. Like so:
.tooltip.top .tooltip-arrow:after {
content: " ";
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
left: -17px;
top: -5px;
border-width: 12px;
border-top-color: #003f6e;
border-bottom:none;
}
.tooltip.top .tooltip-arrow:before {
content: " ";
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
left: -15px;
top: -5px;
border-width: 10px 10px 0;
border-top-color: #fff;
border-bottom:none;
z-index: 1;
}

Bootstrap 3 Carousel full screen flicker

I'm a beginner for web front-end design, using bootstrap to make a project prototype.
I want to do a product like this website
The features I want is
* expand carousel to full screen when visiting the website and then can scroll down to another div element.
I found this similar solution, but unfortunately it uses Carousel as the whole background.
To get the effect I want, I check the javascript src code and edit it.
modify this line (Shown on JSFIDDLE line 13 )
$('.carousel .item').css({'position': 'fixed', 'width': '100%', 'height': '100%'});
into this line (Shown on JSFIDDLE line 13 )
$('.carousel .item').css({'position': 'relative', 'width': $(window).outerWidth(), 'height': $(window).outerHeight()});
Yep, finally get the effect I want!! However, when the photo transition, a unexpected flicker appear, seems the photo is not at right location at first, then go to its right place immediately.
It's annoying when I see the content inside div below, like 1info or 2info.
here is the jsfiddle demo example for the issue.
I tried to use the solution like set z-index, but fail...
Can someone help me to solve this annoying problem? Thanks a lot!!
Here's a flicker-free version without any plugins:
HTML:
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<div id="slide1" class="fill">
<div class=" carousel-caption">
<h1>1</h1>
</div>
</div>
</div>
<div class="item">
<div id="slide2" class="fill">
<div class=" carousel-caption" >
<h1>2</h1>
</div>
</div>
</div>
<div class="item">
<div id="slide3" class="fill">
<div class=" carousel-caption" >
<h1>3</h1>
</div>
</div>
</div>
</div>
</div>
CSS:
html, body {
height: 100%;
}
.carousel, .item, .active {
height: 100%;
}
.carousel-inner {
height: 100%;
}
.fill {
width: 100%;
height: 100%;
background-position: center;
background-size: cover;
}
#slide1 {
background-image: url('http://stylonica.com/wp-content/uploads/2014/03/Cute-Dog-Wallpaper.jpg');
}
#slide2 {
background-image: url('http://hdwallimg.com/wp-content/uploads/2014/02/White-Dog-Running-Wallpaper-HD.jpg');
}
#slide3 {
background-image: url('http://www.petfinder.com/wp-content/uploads/2012/11/122163343-conditioning-dog-loud-noises-632x475.jpg');
}
No additional javascript required, just make sure that the jquery and bootstrap.js files are linked in your page.

Nivo Slider effects are not working

I've searched and tried several of the solutions to no avail. I'm currently using jQuery 1.7.1 and Nivo Slider 3.0.1 .
You can see the website at http://www.wheelerbikeclub.net (this is a website I created last year and I'm just coming back to now).
None of the effects on my nivo slider in my home page are working. I know there was a point last year where they were, but then I changed something and now they don't and I cannot recollect what it is that happened.
I've made sure the number of columns/boxs/slices evenly divide my images. Does anyone have any idea what the issue is? Is it somehow related to the fact that I'm forcing my slider to cover the entire screen?
Thanks for any feedback, I greatly appreciate it!
I make calls for the jQuery followed by NivoSlider script in the head section
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.nivo.slider.3.0.1.js"></script>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider();
});
</script>
Then in my body in a wrapper I put
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<img src="img/new_slides/slide_1-3.png" alt="" title="#slide_1-caption"/>
<img src="img/new_slides/slide_2-4.png" alt="" />
<img src="img/new_slides/slide_4.png" alt="" />
<img src="img/new_slides/slide_3-1.png" alt="" />
</div>
<div id="slide_1-caption" class="nivo-html-caption">
<strong>Find Out More</strong>.
</div>
</div>
There are four images and I'm just testing the caption with image one.
In my nivo-slider css I have (not the entirety, just where I think the problem might lay)
.nivoSlider img {
position:absolute;
top:0px;
left:0px;
z-index:2;
}
.nivo-slice {
display:block;
position:absolute;
z-index:100;
height:100%;
top:0;
}
.nivo-box {
display:block;
position:absolute;
z-index:5;
overflow:hidden;
}
.nivo-box img { display:block; }
And in my main styles.css I have
.slider-wrapper { position:relative;
top: 0px;
left: 0px;
width: 100%;
position:fixed;
z-index:0; }
#slider-div { min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -30px; }
Hope that makes sense.

How do I modify the width of a TabContainer in Dojo

I'm experimenting with Dojo, so far it's very cool except for the fact that I can't seem to be able set the width of a TabContainer. I have the following code
<div id="tabs" dojoType="dijit.layout.TabContainer" doLayout="false">
<div id="javaTab" class="myTab" dojoType="dijit.layout.ContentPane" title="Java">
<h1>Hello I'm the Java Tab</h1>
</div>
<div id="rubyTab" class="myTab" dojoType="dijit.layout.ContentPane" title="Ruby">
<h1>Hello I'm the Ruby Tab</h1>
</div>
</div>
This are the CSS:
#tabs {
width: 100%;
height: 100%;
}
.myTab {
height: 600px;
width: 100%;
padding: 0 !important;
}
If I put a menu bar inside the the tabs then I find that their width is larger than my screen so I don't see the complete bar.
So is there a way to set the width of the generated "tab bar"?
Thanks guys!
Yup Peller is right, you can't set the size on each contentPane, but what you can do is to modify the width of the whole thing (tabContainer)