I'm using Foundation4 as my framework and I want fadein animations to trigger when scrolling down. More like this website: www.isaacpvl.com . I have four divs and they're responsive if these information matters. Thanks to whoever answers! I already tried using firebug and I still can't find how. I'm a newbie when it comes to javascript.
Here are the codes I've done so far. It's just a mock-up to see how things would look like, not too much on the design yet.
<div class="row">
<div style="background-color: black;" id="head" class="large-12 columns">
</div>
</div>
<div class="row">
<div style="background-color: red;" id="section1" class="large-6 columns">
</div>
<div style="background-color: red;" id="section1" class="large-6 columns">
<img class="animated fadeInRight" src="img/hongkong/hongkongdragon.gif" />
</div>
</div>
<div class="row">
<div style="background-color: blue;" id="section2" class="large-12 columns">
</div>
</div>
that's the body so far and the css of the divs
.row.full-width { width: 100%; max-width: 100%; }
.row {min-width:100% !important; background-color: black;}
.section1{
/*background-image: url("../img/hongkong/background.png");*/
background-color:red;
position: relative;
background-position: top center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
}
.section2{
/*background-image: url("../img/hongkong/background.png");*/
background-color: black;
position: relative;
background-position: top center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
}
As you can see there is an image source with the animated class, that's the image that I want to animate. It's a full-screen kind of website.
I'm using animate.css from http://daneden.me/animate/ btw
Related
<link href="https://www1.chester.ac.uk/sites/all/themes/global/css/app_chester.css" rel="stylesheet"/>
<div style="background: #eaeaea">
<div class="column row">
<div class="m-modal-video__column m-modal-video__column--primary">
<div class="m-modal-video m-modal-video--primary-full-width">
<div class="m-cta__vcenter"><h3 style="color: black; text-align: center;">Be Part of It</h3>
<p style="color: black; text-align: center;">Choose an innovative degree that has been designed with your employability at its core.</p>
</div>
</div>
</div>
<div class="m-modal-video__column m-modal-video__column--secondary">
<div class="m-modal-video m-modal-video--primary-full-width">
<div class="m-cta__vcenter">
<div class="m-modal-video__container m-modal-video__container--cinemascope" data-open="youtubemodal">
<a><img src="http://img.youtube.com/vi/Ily454tCpWE/maxresdefault.jpg">
<div class="m-modal-video__overlay m-modal-video__overlay--triangle">
<div class="m-modal-video m-modal-video__triangle"></div>
</div></a>
</div>
<div class="reveal large" id="youtubemodal" data-reveal data-reset-on-close="true">
<div class="m-video m-video--modal m-video--cinemascope"><iframe src="https://www.youtube.com/embed/Ily454tCpWE" frameborder="0" allowfullscreen=""></iframe></div>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
I've got a modal on my site, and use the following to display a thumbnail image:
http://img.youtube.com/vi/DxwrdB7A6-I/maxresdefault.jpg
The problem is the video has an aspect ratio of 21:9. I've used the following styles, but still get the black letterbox on both the top and bottom of the image. Is there a way to just display the YouTube thumbnail without the black letterbox?
&__container {
position: relative;
height: 0;
padding-bottom: 42.85714%;
overflow: hidden;
margin-bottom: 1rem;
a img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
I've modified your sample code to add two new CSS rules to correspond to a class your HTML already had with no styles:
.m-modal-video__container--cinemascope defines the container around your cinemascope-ratio image, using the padding-bottom trick you'd previously tried implementing.
.m-modal-video__container--cinemascope img defines the sizing and positioning of the image inside the above container. Knowing you want this image to maintain its aspect ratio and not stretch, I've removed the height: 100% rule (so the height is automatically calculated) and vertically centered the image with the top: 50% and transform: translateY(-50%) trick.
This is all needed because YouTube still produced a 16:9 JPG thumbnail for your video despite its 21:9 ratio, so we're essentially using this trick to hide the black bars in the image. I still see a tiny sliver poking through, but you slightly adjust your padding-bottom ratio if you were worried about that, or increase your img's width past 100%.
.m-modal-video__container--cinemascope {
position: relative;
height: 0;
padding-bottom: 42.85714%;
overflow: hidden;
}
.m-modal-video__container--cinemascope img {
position: absolute;
left: 0;
width: 100%;
top: 50%;
transform: translateY(-50%);
}
<link href="https://www1.chester.ac.uk/sites/all/themes/global/css/app_chester.css" rel="stylesheet" />
<div style="background: #eaeaea">
<div class="column row">
<div class="m-modal-video__column m-modal-video__column--secondary">
<div class="m-modal-video m-modal-video--primary-full-width">
<div class="m-cta__vcenter">
<div class="m-modal-video__container m-modal-video__container--cinemascope" data-open="youtubemodal">
<a><img src="http://img.youtube.com/vi/Ily454tCpWE/maxresdefault.jpg">
<div class="m-modal-video__overlay m-modal-video__overlay--triangle">
<div class="m-modal-video m-modal-video__triangle"></div>
</div>
</a>
</div>
<div class="reveal large" id="youtubemodal" data-reveal data-reset-on-close="true">
<div class="m-video m-video--modal m-video--cinemascope"><iframe src="https://www.youtube.com/embed/Ily454tCpWE" frameborder="0" allowfullscreen=""></iframe></div>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
Below is the code :
I want to select the radio button which is present within the span class. Could you please help in identifying a successful xpath ?
<div id="quicklinkbox" class="col-md-2" data-position="left" data-intro="You can directly download payslip PDFs for the last 3 or 6 months. (India payslip only)" data-step="4">
<div style="background-color: transparent; margin-top: 28px;">
<div id="panel-title" ng-click="changeExpand(expand);" style="position: relative; left: 24px; cursor: pointer; font-weight: 500;">Quick Download</div>
<div id="panel-title" class="panel-body" style="text-align: left; font-weight: lighter; padding: 5px 0px 0px 50px; font-weight: 400">
<span style="margin-left: -16px;">Payslips for</span>
<form class="ng-pristine ng-valid">
<div class="form-group">
<div class="radio">
<span same-heightcol="" style="font-size: 16px;">
<input class="ng-pristine ng-valid" type="radio" ng-model="payslipselectedopt" style="cursor: pointer;" value="3" name="payslipradio"/>
<span style="font-size: 16px; position: relative; top: -5px;">Last 3 months</span>
</span>
</div>
<div class="radio">
<span style="font-size: 16px;">
<input class="ng-pristine ng-valid" type="radio" ng-model="payslipselectedopt" value="6" name="payslipradio" style="cursor: pointer;"/>
<span style="font-size: 16px; position: relative; top: -5px;"> Last 6 months</span>
</span>
</div>
<img style="margin-bottom: -12px; margin-left: -16px; cursor: pointer;" ng-click="downloadbulkpayslip()" src="appResources/images/Download-button.png"/>
</div>
</form>
</div>
</div>
</div>
</div>
You can use:
//span/input[#name='payslipradio' and #value='6']
Explanation:
//span -> Will search in all HTML al span tag
/input -> Will searth inside the span tag previous selected a input tag
[#name='payslipradio' and #value='6'] -> Will search in the previous selected tags one that the name attr is equals to 'pslpradio' and value attr equals to '6'
//*span[input#class='ng-pristine ng-valid' and #type='radio']))
So I want to make a row of images that are inside skewed containers. Please see the image to fully understand:
The best I've gotten so far is skewing the container around an image, but there are 2 problems with this: the image inside becomes skewed and there are gaps on the far left and the far right.
HTML:
<section>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
<div class="image-wrap">
<img src="http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg">
</div>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
<div class="image-wrap">
<img src="http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg">
</div>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
</section>
What I have so far:
CSS:
html, body {
width: 100%;
}
section {
display: flex;
height: 250px;
overflow: hidden;
}
.image-wrap {
width: 20%;
height: 100px;
transform: skew(-5deg);
img {
width: 100%;
height: 140px;
}
}
http://codepen.io/mildrenben/pen/oXjzrK
There is a way to do this pretty nicely with clip-path but the problem is this isn't very well supported at the moment. See more on that here and learn more about clip-path here.
Here is an example:
html, body {
width: 100%;
}
section {
display: flex;
height: 250px;
overflow: hidden;
}
.image-wrap {
width: 30%;
height: 100px;
-webkit-clip-path: polygon(10% 0%, 100% 0, 90% 100%, 0 100%);
clip-path: polygon(10% 0%, 100% 0, 90% 100%, 0 100%);
margin-left: -3%;
}
.image-wrap:last-child {
-webkit-clip-path: none;
clip-path: none;
}
img {
width: 100%;
height: 140px;
}
<section>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
<div class="image-wrap">
<img src="http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg">
</div>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
<div class="image-wrap">
<img src="http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg">
</div>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
</section>
One possible solution (but not really really elegant) would be to skew the parent container in one direction, and then the children to the opposite direction. In the same time, if you could set those images as bg images would be better because you'd have a greater control over background size.
The downsizes for this approach would be:
setting background images as inline styles (if they are dynamic);
you need to calculate the exact percentage needed to pull child image to left/right so you could fill the entire space created by the skew's transformation angle (I've set it to 5%, just for demo purposes).
To sum up, it's your choice if you could integrate this into your app.
html,
body {
width: 100%;
}
section {
display: flex;
height: 250px;
overflow: hidden;
}
.image-wrap {
border: 1px solid blue;
width: 20%;
height: 120px;
transform: skew(-5deg);
overflow: hidden;
position: relative;
backface-visibility: hidden;
}
.image-wrap img,
.image-wrap .thumb {
transform: skew(5deg);
position: absolute;
right: -5%;
left: -5%;
top: 0;
bottom: 0;
}
<section>
<div class="image-wrap">
<div class="thumb" style="background: url('http://i.imgur.com/pHCV0Vt.jpg') no-repeat transparent;"></div>
</div>
<div class="image-wrap">
<div class="thumb" style="background: url('http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg') no-repeat transparent;"></div>
</div>
<div class="image-wrap">
<div class="thumb" style="background: url('http://i.imgur.com/pHCV0Vt.jpg') no-repeat transparent;"></div>
</div>
<div class="image-wrap">
<div class="thumb" style="background: url('http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg') no-repeat transparent;"></div>
</div>
<div class="image-wrap">
<div class="thumb" style="background: url('http://i.imgur.com/pHCV0Vt.jpg') no-repeat transparent;"></div>
</div>
</section>
I know it's not the cleanest solution but this is what I came up on the moment.
Based on your example you can make it something like this. Just play with the .image-wrap height to achieve perfect balance between the image and the wrap :)
*{
margin: 0;
}
html, body {
width: 100%;
}
section {
display: flex;
height: 250px;
overflow: hidden;
}
.image-wrap {
width: 20%;
height: 250px;
-webkit-transform: skew(-5deg);
-ms-transform: skew(-5deg);
transform: skew(-5deg);
overflow: hidden;
}
.image-wrap img {
width: auto;
min-width: 100%;
min-height: 100%;
-webkit-transform: skew(5deg);
-ms-transform: skew(5deg);
transform: skew(5deg);
}
<section>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
<div class="image-wrap">
<img src="http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg">
</div>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
<div class="image-wrap">
<img src="http://screenshots.en.sftcdn.net/en/scrn/90000/90064/league-of-legends-35.jpg">
</div>
<div class="image-wrap">
<img src="http://i.imgur.com/pHCV0Vt.jpg">
</div>
</section>
I have a small website using Bootstrap 3.0 RC1 and I am just trying to center a simple image (with responsive rendering)
So everything seems to work on desktop devices, but when I look at my website on a small device like a mobile, the image is resized (thats good) but NOT perfectly centered.....
I am puzzled..
Any idea?
Many thanks in advance,
I use the following code :
<body style="display: block;">
<section class="container">
<header>
<div class="row">
<div class="col-lg-6 col-offset-3">
<center><img src="img/grey_wash_wall.png" class="text-center" title="Hello" alt="World"></center>
</div>
</div>
<div class="row">
<div class="title col-lg-12">
<h1>Welcome to my website</h1>
</div>
</div>
</header>
You're missing a closing bracket on your .container CSS.
.container {
max-width: 700px;
background:white;
padding: 30px 50px;
margin: 20px auto;
text-align: center;
}
EDIT:
I'm unable to replicate this behavior on a mobile-sized browser window using the markup you provided. jsFiddle
I think i found a strange bug in firefox.
When i have an hover class on a div with a background-size property (with a change in the opacity) the size of some of the image a use in the background, changes by one pixel in horizontal, or in vertical.
I made an example of the probleme here:
http://jsfiddle.net/xz4F8/
the html:
<div class="group cont_tutto">
<div class="conteiner_articoli_cinema">
<div class="back_navigazione_articoli-mag">
<div class="articolo_mag">
<div class="tipo-articoli-mag">speciale cinema</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/16072013/Now-You-See-Me--I-maghi-del-crimine_articolo.jpg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div>
</div>
<div class="articolo_mag">
<div class="tipo-articoli-mag">speciale cinema</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/16072013/theloneranger384470.jpg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div>
</div>
<div class="articolo_mag">
<div class="tipo-articoli-mag">rcensione fumetti</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/16072013/Nodo-alla-gola_articolo.jpg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div></div>
<div class="articolo_mag">
<div class="tipo-articoli-mag">recensione cinema</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/15072013/Distribuzione-cinema-e-dvd_articolo.jpg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div>
</div>
<div class="articolo_mag">
<div class="tipo-articoli-mag">recensione serie tv</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/08072013/trueblood-stagione6309717.jpg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div>
</div>
<div class="articolo_mag">
<div class="tipo-articoli-mag">recensione blu-ray</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/13072013/ax967523.jpeg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div>
</div>
<div class="articolo_mag">
<div class="tipo-articoli-mag">recensione cinema</div>
<a href="http://www.google.it">
<div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/12072013/lareligiosa825433.jpg')"></div>
</a>
<div class="mag_titolo">
<h2>the lone ranger </h2>
</div>
</div>
</div>
</div>
</div>
The css:
#charset "utf-8";
/* CSS Document */
.articolo_mag {
background-color: #EFEFEF;
float: left;
width: 129px;
margin-right: 6px;
}
.articolo_mag_cover {
width: 129px;
height: 177px;
background-size:129px 177px;
background-color: #333;
}
.articolo_mag_cover:hover {
background-size:129px 177px;
opacity: 0.9;}
.mag_titolo {}
.mag_titolo h2 {display: table-cell;
vertical-align: middle;
background-color: #FFF;
font-size: 10px;
font-family: Lato, Arial;
font-weight: bold;
border: 1px solid #D9D9D9;
text-align: center;
text-transform: uppercase;
padding-top: 0px;
padding-bottom: 0px;
height: 30px;}
.mag_titolo h2:hover { color: #09F;
background-color: #E4E4E4;}
.mag_titolo h2 a {
display: block;
color: #000000;
text-decoration: none;
text-transform: uppercase;
width: 119px;
line-height: normal;
padding-right: 4px;
padding-left: 4px;
padding-bottom: 0px;
}
.tipo-articoli-mag {
background-color: rgba(0,0,0,0.75);
height: 17px;
width: 115px;
color: #FFF;
font-family: Lato, Arial;
font-size: 10px;
font-weight: bold;
padding-top: 3px;
padding-left: 5px;
text-transform: uppercase;
left: 5px;
z-index: 25;
position: relative;
float: left;
margin-top: 150px;
}
If i use the cover option for the background-size,the size problems seems attenuated, but, some of the images start to flicker during the update of the page, or the hover state (seems to me, firefox can't decide witch is the right size of the image )
It seems that the problem is triggered by the div container that i use to center all the content in my page (cont_tutto) witch has a 951px in width..
No problem at all on all the other browsers!
You had to add "-moz-backface-visibility: hidden" to solve the problem. Here is the solution: http://nickpye.com/2013/04/03/css3-opacity-transition-image-wiggle-bug-in-mozilla-firefox/
Try to add
transform: rotate(360deg);
somewhere as i did to the following image that was moving 1px when hover
.btnRoll:hover img {
filter: alpha(opacity=80);
opacity: 0.8;
transform: rotate(360deg);
}
I have recently experienced the same problem, which is the exact reason I have chosen to stick to the built in "Inspect Element" function in Firefox
Tanner