http://codepen.io/kjohnson/pen/azBvaE
My friend and I are thinking of using that timeline in our website. But the problem is we've 5 sections that needs to be added to timeline, whereas the original timeline have only 3 sections.
I've tried to add two more sections to that code, but it's losing its shape and responsiveness.
Is it possible to extend that timeline and maintain its responsiveness?
HTML
<!-- STEPS -->
<section id="Steps" class="steps-section">
<h2 class="steps-header">
Responsive Semantic Timeline
</h2>
<div class="steps-timeline">
<div class="steps-one">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Semantic
</h3>
<p class="steps-description">
The timeline is created using negative margins and a top border.
</p>
</div>
<div class="steps-two">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Relative
</h3>
<p class="steps-description">
All elements are positioned realtive to the parent. No absolute positioning.
</p>
</div>
<div class="steps-three">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Contained
</h3>
<p class="steps-description">
The timeline does not extend past the first and last elements.
</p>
</div>
</div><!-- /.steps-timeline -->
CSS
$outline-width: 0;
$break-point: 500px;
#import url(http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: lato;
}
$gray-base: #999999;
$brand-primary: #3498DB; //Zen Blue
.section-header {
color: $brand-primary;
font-weight: 400;
font-size: 1.4em;
}
.steps-header {
#extend .section-header;
margin-bottom: 20px;
text-align: center;
}
.steps-timeline {
outline: 1px dashed rgba(red, $outline-width);
#media screen and (max-width: $break-point) {
border-left: 2px solid $brand-primary;
margin-left: 25px;
}
#media screen and (min-width: $break-point) {
border-top: 2px solid $brand-primary;
padding-top: 20px;
margin-top: 40px;
margin-left: 16.65%;
margin-right: 16.65%;
}
&:after {
content: "";
display: table;
clear: both;
}
}
.steps-one,
.steps-two,
.steps-three {
outline: 1px dashed rgba(green, $outline-width);
#media screen and (max-width: $break-point) {
margin-left: -25px;
}
#media screen and (min-width: $break-point) {
float: left;
width: 33%;
margin-top: -50px;
}
}
.steps-one,
.steps-two {
#media screen and (max-width: $break-point) {
padding-bottom: 40px;
}
}
.steps-one {
#media screen and (min-width: $break-point) {
margin-left: -16.65%;
margin-right: 16.65%;
}
}
.steps-two {
}
.steps-three {
#media screen and (max-width: $break-point) {
margin-bottom: -100%;
}
#media screen and (min-width: $break-point) {
margin-left: 16.65%;
margin-right: -16.65%;
}
}
.steps-img {
display: block;
margin: auto;
width: 50px;
height: 50px;
border-radius: 50%;
#media screen and (max-width: $break-point) {
float: left;
margin-right: 20px;
}
}
.steps-name,
.steps-description {
margin: 0;
}
.steps-name {
#extend .section-header;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
.steps-description {
overflow: hidden;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
If you a novice I'd recommend you LEARN first. Copy templates/snippets is good to save your time when you know what you are doing.
I found a perfect tutorial for you here
Just to emphasize that's my opinion, I hope it helps in a certain way..
EDIT: If still want to develop in that way here's a codepen snippet with a fully responsive horizontal timeline. Just have to put more <li> inside the <ul>
Related
I am testing responsiveness in my react app and I have come across a pretty confusing issue while working with my devtools console. The width of the element I am working with is 768px. These are the same dimensions for a tablet screen. However, the element width only covers part of the screen as shown in the screenshot below.
Where is this extra space on the right coming from? I believe the element should cover the entire width of the screen since the dimensions are equal. I have also in my CSS file:
html, body {
margin: 0;
padding: 0;
}
My full CSS file looks like this:
#import url("https://fonts.googleapis.com/css?family=Akaya+Telivigala&display=swap");
.projects {
display: inline-block;
width: 500px;
font-size: 1.7em;
color: white;
width: 100%;
height: 100vh;
}
.indivProject {
display: grid;
grid-template-columns: 900px 120px;
}
.projImage img {
width: 450px;
height: 450px;
margin-top: 150px;
}
#media screen and (min-width: 320px) {
.projects {
width: 100%;
margin-left: 60px;
height: 100%;
}
}
#media screen and (min-width: 768px) {
.projects {
width: 100%;
margin-left: 60px;
height: 100%;
}
}
.project-text {
color: white;
font-size: 0.8em;
margin-left: 180px;
margin-top: 240px;
}
.tech {
margin-left: 250px;
font-size: 0.7em;
color: rgb(9, 150, 79);
}
#media screen and (min-width: 320px) {
.project-text {
margin-left: 80px;
font-size: 1.7em;
width: 100%;
}
}
#media screen and (min-width: 768px) {
.project-text {
text-align: center;
}
}
#media screen and (min-width: 320px) {
.projImage img {
display: none;
}
}
a {
text-decoration: none;
color: rgb(9, 150, 79);
}
a:hover {
color: saddlebrown;
}
h4 {
color: rgb(15, 89, 102);
text-align: center;
font-size: 1.2em;
}
The corresponding markup looks like this:
import React from 'react';
import './styles.css';
import nutri from '../../images/nutri.png';
import akan from '../../images/akan.png';
import convo from '../../images/convo.png';
function Projects(){
return (
<div className="projects">
<h4>HIGHLIGHTED PROJECTS</h4>
<div data-aos="zoom-out" className="indivProject">
<div data-aos="zoom-out" className="project-text">
<p>
<h3>TEXTR</h3>
This is a mobile-responsive messaging app built using React and leverages the use of ChatEngine to provide an interactive communication experience. Hosted on Netlify.
</p>
<ul className="tech">
<li>React</li>
<li>Chat Engine</li>
<li>React Testing Library</li>
</ul>
</div>
<div className="projImage"><img src={convo} alt=""></img></div>
</div>
<div data-aos="zoom-out" className="indivProject">
<div data-aos="zoom-out" className="project-text">
<p>
<h3>NUTRIAPP</h3>
This is an application that acts more like a remote doctor. By inputing some personal data such as Weight, Height and Physical activity, the user reveives ther caloric intake recommendation and is able to evaluate their health status.
</p>
<ul className="tech">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</div>
<div className="projImage"><img src={nutri} alt=""></img></div>
</div>
<div data-aos="zoom-out" className="indivProject">
<div data-aos="zoom-out" className="project-text">
<p>
<h3>AKAN NAMES</h3>
Akan names are derived from Ghanian culture. Frequently in Ghana, children are given their first name as a 'day name' which corresponds to the day in the week they were born. This application will help you identify an Akan name based on the time you were born.
</p>
<ul className="tech">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</div>
<div className="projImage"><img src={akan} alt=""></img></div>
</div>
</div>
)
}
export default Projects;
I have tried restarting my devtools but still no resolve.
Like the title says, it is only the text at the far right off the screen that is cut off, when I inspect and view smaller device sizes.
Here is my HTML:
* {
margin: 0;
}
body {
overflow-x: hidden;
}
.wrapper1 {
display: grid;
grid-template-columns: 6fr 3fr;
border: 2px solid #6cccb0;
overflow: hidden;
height: 30px;
background-color: #6cccb0;
width: 1700px;
}
<div class="wrapper1">
<div>
<p class="item1">SHIPPED for free | GUARANTEED TO LAST</p>
</div>
<div>
<p class="item2">LOG IN | REGISTER | CUSTOMER SERVICE | 1-800-692-8259 </p>
</div>
</div>
Thanks
Why not remove the hard-set width and the overflow: hidden properties? These are causing your content to be both offscreen and also cut.
* {
margin: 0;
}
.wrapper1 {
display: grid;
grid-template-columns: 2fr 1fr;
align-items: center;
border: 2px solid #6cccb0;
background-color: #6cccb0;
}
<div class="wrapper1">
<div>
<p class="item1">SHIPPED for free | GUARANTEED TO LAST</p>
</div>
<div>
<p class="item2">LOG IN | REGISTER | CUSTOMER SERVICE | 1-800-692-8259 </p>
</div>
</div>
You could use
width: 100%;
instead of
width: 1700px;
So your item2 text will not disappear.
Edit 1:
In case you want to keep your text in one line, I suggest using #media queries to change your font-size. so your css must be something like this.
* {
margin: 0;
}
.wrapper1 {
display: grid;
grid-template-columns: 2fr 2fr;
border: 2px solid #6cccb0;
height: 30px;
background-color: #6cccb0;
font-size: 1em;
color: orange;
}
#media only screen and (max-width: 440px) {
.wrapper1 {
font-size: 0.4em;
color: yellow;
}
}
#media only screen and (min-width: 440px) {
.wrapper1 {
font-size: 0.5em;
color: aqua;
}
}
#media only screen and (min-width: 560px) {
.wrapper1 {
font-size: 0.6em;
color: green;
}
}
#media only screen and (min-width: 728px) {
.wrapper1 {
font-size: 0.8em;
color: blue;
}
}
#media only screen and (min-width: 1024px) {
.wrapper1 {
font-size: 1em;
color: red;
}
}
I put color rules to help you understand what's happening. You can delete them. I hope it would help you.
I'm learning responsive CSS, so this is all fairly new to me. However, why aren't the images on the 2nd row hugging the top images?
Ideally I just want 4 images per row, but if on a smaller screen or phone etc. it will dynamically reduce the image size and reduce the number of images per row. Cannot seem to get this working? Any help is appreciated! All CSS relative for the images is on that one static page.
div.gallery {
border: 1px solid #ccc;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery img {
width: 100%;
height: auto;
}
div.desc {
padding: 10px;
text-align: center;
}
* {
box-sizing: border-box;
}
.responsive {
padding: 0 6px;
float: right;
width: 24.99999%;
}
#media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
#media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://memorybox.pt">
<img src="images/memory-box.png" alt="Algarve Wedding Photography" width="600" height="400">
</a>
<div class="desc">Algarve Wedding Planners</div>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://algarvedjhire.com/">
<img src="images/algarve_dj_hire.jpg" alt="Algarve Wedding Photography" width="600" height="400">
</a>
<div class="desc">Algarve DJ & Music</div>
</div>
Use height and instead of float right use float left in your .responsive class. See example below. I use height 290px you can use based on your need.
.responsive {
padding: 0 6px;
float: left;
width: 24.99999%;
height: 290px;
}
Also you can use margin-bottom in your responsive break point so that it's look good. See example below.
#media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0 30px 0;
}
}
I want to have three different layouts of my web page for different browser widths (i.e. desktop, tablet, phone).
In the tablet layout (between 768px and 991px of the browser) I should have three elements, two in the first row (thus each of them taking 6/12 of the browser width) and the a third in the second row (taking 12/12 of the browser width).
This is what I want:
What I want - IMAGE
But I have a problem with this layout:
I am not able to set the third element borders aligned with the left and right borders of first and second element, as you see.
This is what I have done:
What I have - IMAGE
Can you help me?
Note: I want the element '3' wide as '1'+'2' width only for tablet layouts! For other layouts I want what I already did, i.e same width for every element (1,2 or 3).
This is the html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Our Menu</title>
<link rel ="stylesheet" href="css/style.css">
</head>
<body>
<h1>Our Menu</h1>
<div class="row">
<div class="col-lg-4 col-md-6 col-sd-12 anchor">
<p class="content"> In girum imus nocte et consimur igni.</p>
<p class="my-title" id="p1"> Chicken</p>
</div>
<div class="col-lg-4 col-md-6 col-sd-12 anchor">
<p class="content"> In girum imus nocte et consimur igni.</p>
<p class="my-title" id="p2"> Beef</p>
</div>
<div class="col-lg-4 col-md-12 col-sd-12 anchor">
<p class="content"> In girum imus nocte et consimur igni.</p>
<p class="my-title" id="p3"> Sushi</p>
</div>
</div>
</body>
</html>
This is the css:
/* width and height will include border and padding */
* {
box-sizing: border-box;
}
h1 {
margin-bottom: 15px;
text-align: center;
}
/*Set an anchor for the container of p elements*/
div.anchor{
position: relative;
}
#p1{
background-color: yellow;
}
#p2{
background-color: #ff0000;
}
#p3{
background-color: #ffaabb;
}
/*.col-md-12 .content{
margin-right: 2.5%;
margin-left: 2.5%;
*/
p.content{
border: 1px solid black;
background-color: #a3d3d3;
/*width: 90%; /*Specifies a percentage width. The percentage is calculated with respect to the width of the generated box's containing block.*/
height: 150px;
margin-right: 5%;
margin-left: 5%;
font-family: Helvetica;
color: white;
padding: 20px;
}
p.my-title{
position: absolute;
top: 0px;
right: 0px;
width: 80px;
height: 20px;
margin: 0px;
border: 1px solid black;
text-align: center;
margin-right: 5%;/*inherit; 22.525px; inherit*/
margin-top: 16px;
/*margin-right: auto;
margin-left: auto;
font-family: Helvetica;*/
color: black;
}
/* Simple Responsive Framework. */
.row {
width: 100%;
}
/********** desktop devices only **********/
#media (min-width: 992px) {
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4 {
float: left;
}
.col-lg-1 {
width: 8.33%;
}
.col-lg-2 {
width: 16.66%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-4 {
width: 33.33%;
}
}
/********** Tablet devices only **********/
#media (min-width: 768px) and (max-width: 991px) {
.col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-12 {
float: left;
}
.col-md-4 {
width: 33.33%;
}
.col-md-5 {
width: 41.66%;
}
.col-md-6 {
width: 50%;
}
.col-md-7 {
width: 58.33%;
}
.col-md-8 {
width: 66.66%;
}
.col-md-12 {
width: 100%;
/*margin-right: -5.5%;
margin-left: -2.8%;*/
}
}
/********** mobile devices only **********/
/* the floating is only defined inside the media queries.
The elements will behave just like regular block level elements,
and they will automatically stack one on top of the other.
Anyway, it's better to explicit define the media query also for
mobile phones. */
#media (max-width: 767px) {
.col-sd-9, .col-sd-10, .col-sd-11, .col-sd-12 {
float: left;
}
.col-sd-9 {
width: 74.99%;
}
.col-sd-10 {
width: 83.33%;
}
.col-sd-11 {
width: 91.66%;
}
.col-sd-12 {
width: 100%;
}
}
Thank you!
check this fiddle
div.anchor{
position: relative;
padding: 0 15px;
}
p.content{
border: 1px solid black;
background-color: #a3d3d3;
/*width: 90%; /*Specifies a percentage width. The percentage is calculated with respect to the width of the generated box's containing block.*/
height: 150px;
/* margin-right: 5%;
margin-left: 5%; */
font-family: Helvetica;
color: white;
padding: 20px;
}
p.my-title{
position: absolute;
top: 16px;
right: 15px;
width: 80px;
height: 20px;
margin: 0px;
border: 1px solid black;
text-align: center;
/* margin-right: 5%;inherit; 22.525px; inherit
margin-top: 16px; */
/*margin-right: auto;
margin-left: auto;
font-family: Helvetica;*/
color: black;
}
EDITS:
removed margin left and right on p.content and p.my-title, added padding on div.anchor and top and right position on p.my-title
I am very new to tumblr and jQuery Masonry, I have create a test blog.
I have a timeline design, by which posts are aligned in two sides and also I used Masonry to remove the space between the posts.
And I have added responsive behavior to this.
Post and Masonry is working properly with responsive on different window size when the page loads but when i resize the window, its design goes to haywire.
I am not able to identify is it my code's mistake or Masonry's :(
Any help will be really helpful.
It is not working with only (min-width: 768px), (min-width: 1024px) and (min-width: 1824px)
Here is my code:
JS
$(document).ready(function() {
if ($(window).width() <= 679) {
$('#posts_container').masonry('destroy');
}
if ($(window).width() > 680) {
$('#posts_container').masonry({itemSelector: '.shadow', });
}
Arrow_Points();
});
function Arrow_Points() {
//alert("function call");
var s = $('#posts_container').find('.shadow');
$.each(s, function(i, obj) {
var posLeft = $(obj).css("left");
$(obj).addClass('borderclass');
if (posLeft == "0px") {
html = "<span class='rightCorner'></span>";
html += "<div class='rightpostcorner'></div>";
$(obj).prepend(html);
$(this).addClass('margin_hack_left_post');
}
else
{
html = "<span class='leftCorner'></span>";
html += "<div class='leftpostcorner'></div>";
$(obj).prepend(html);
$(this).addClass('margin_hack_right_post');
}
});
}
Media
#media only screen and (max-width: 480px) {
.wrapper {width: 100%;}
.rightCorner, .leftCorner{ display: none; }
.shadow {width: 90%; margin: 40px 5% 10px 5%; }
}
#media only screen and (max-width: 680px) and (min-width: 480px){
.wrapper {width: 100%;}
.rightCorner, .leftCorner{ display: none; }
}
#media only screen and (max-width: 768px) and (min-width: 680px){
.wrapper {width: 100%;}
.rightCorner, .leftCorner{ display: none; }
.shadow {width: 90%; margin: 40px 5% 10px 5%; }
}
#media only screen and (min-width: 768px) and (max-width: 1024px) {
.leftCorner { margin-left:-9%;}
.shadow { width: 45.5%; margin-top: 40px; }
.margin_hack_left_post { margin-left:1.5%%; }
.margin_hack_right_post { margin-left:7.5%; }
}
#media only screen and (min-width: 1025px) and (max-width: 1824px) {
.wrapper {width: 100%; }
.leftCorner {margin-left: -5.5%; }
.shadow { width: 43.7%; margin-top: 40px; }
.margin_hack_left_post { margin-left:4%; }
.margin_hack_right_post { margin-left:8%; }
}
/* LARGE SCREENS */
#media only screen and (min-width: 1824px) {
.wrapper {width: 1200px; margin: 0 auto;}
.shadow { width: 43.7%; margin-top: 40px; }
.margin_hack_left_post { margin-left:4%; }
.margin_hack_right_post { margin-left:8%; }
}
My CSS:
.shadow
{
float: left;
background-color: #ffffff;
min-height: 50px;
text-align: justify;
word-wrap:break-word;
}
.timeline_container
{
width: 16px;
text-align: center;
margin: 0 auto;
cursor:pointer;
display: block;
}
.timeline
{
margin: 0 auto;
background-color: red;
display: block;
float: left;
height: 100%;
left: 49.75%;
position: absolute;
width: 1px;
z-index: -1;
}
.timeline:hover{cursor: pointer;margin: 0 auto;}
.timeline div.plus{width: 14px;height: 14px;position: relative;left: -6px;}
.rightCorner
{
background-image: url("xyz.png");
height: 30px;
margin-left: 99.5%;
margin-top: 8px;
padding: 0;
vertical-align: top;
width: 30px;
z-index: 2;
position: absolute;
}
.leftCorner
{
background-image: url("abc.png");
height: 30px;
width: 30px;
margin-top: 8px;
position: absolute;
z-index:2;
}
.content
{
margin-left: auto;
margin-right: auto;
max-width: none;
min-width: 86%;
position: relative;
z-index: 2;
}
And my tumblr HTML is
{block:Posts}
<article class="shadow">
{block:Date}
<div class="post_info">
<section class="post-controls">
<ul style="padding-left: 0px; float: left; width:80%">
<li style="width: 30%; margin-left: 0px; padding-left: 0px; margin-top: 7px;">
<i class="icon-clock"></i> {DayOfMonthWithZero} {ShortMonth} {ShortYear}
</li>
{block:NoteCount}<li style="width: 30%; margin-left: 0px; padding-left: 0px; margin-top: 7px;">
<i class="icon-heart"></i> {NoteCount}</li>{/block:NoteCount}
</ul>
<ul style="float:right;">
<li class="like_link">{ReblogButton size="20"}</li>
<li class="reblog_link">{LikeButton size="20"}</li>
</ul>
</section>
</div>
{/block:Date}
<div class="post_padding">
{block:Audio}
<div class="audio" id="{PostID}">
<div class="album_art">{block:AlbumArt}<img class="scale-with-grid" src="{AlbumArtURL}" />{/block:AlbumArt}</div>
<div class="audio_player_container">
{block:AudioEmbed}{AudioEmbed}{/block:AudioEmbed}
{block:AudioPlayer}{AudioPlayerWhite}{/block:AudioPlayer}
</div>
<div class="caption">
<ul class="audio_details">
{block:TrackName}<li><span class="audio_bold">Song Title:</span> {TrackName}</li>{/block:TrackName}
{block:Artist}<li><span class="audio_bold">Artist:</span> {Artist}</li>{/block:Artist}
{block:Album}<li><span class="audio_bold">Album:</span> {Album}</li>{/block:Album}
<li><span class="audio_bold">Plays:</span> {PlayCount}</li>
</ul>
{block:Caption}{caption}{/block:Caption}
</div>
</div>
{/block:Audio}
{block:Chat}
{block:Title}<div class="chat_title"><h2>{Title}</h2></div>{/block:Title}
{block:Lines}
<div class="lines"><div class="line {Alt}">{block:Label}<strong>{Label}</strong>{/block:Label} {Line}</div></div>
{/block:Lines}
{/block:Chat}
{block:Link}
<div class="link_title"><a href="{URL}" {Target}>{Name} →</a></div>
<div class="caption">{block:Description}{Description}{/block:Description}</div>
{/block:Link}
{block:Photo}
<div class="photo_post">
<a href="{Permalink}" rel="prettyPhoto">
<img class="scale-with-grid" src="{PhotoURL-HighRes}"/>
</a>
</div>
{block:Caption}<div class="caption">{Caption}</div>{/block:Caption}
{/block:Photo}
{block:Photoset}
<div class="photo-slideshow" data-layout="{PhotosetLayout}">
{block:Photos}
<div class="photo-data">
<div class="photo">
<a href="{Permalink}" rel="prettyPhoto[set]">
<img alt="{PhotoAlt}" src="{PhotoURL-500}" data-highres="{PhotoURL-HighRes}" class="{block:Exif}exif-yes {/block:Exif}{block:Caption}caption-yes{/block:Caption}" {block:Exif}data-camera="{block:Camera}{Camera}{/block:Camera}" data-iso="{block:ISO}{ISO}{/block:ISO}" data-aperture="{block:Aperture}{Aperture}{/block:Aperture}" data-exposure="{block:Exposure}{Exposure}{/block:Exposure}" data-focal="{block:FocalLength}{FocalLength}{/block:FocalLength}"{/block:Exif} {block:Caption}data-caption="{Caption}"{/block:Caption}>
</a>
</div>
<div class="icons">
<a rel="prettyPhoto" class="view" rel="post-{PostID}" href="{PhotoURL-HighRes}"><span class="zoom">Zoom</span></a>
<span class="info">Info</span>
</div>
</div>
{/block:Photos}
</div><!-- close SLIDESHOW -->
<div class="caption">{block:Caption}{Caption}{/block:Caption}</div>
{/block:Photoset}
{block:Quote}
<div class="quote_title"><h2>"{Quote}"</h2></div>
<div class="caption"><p>{block:Source}- {Source}{/block:Source}</p></div>
{/block:Quote}
{block:Text}
{block:Title}<div class="post_title"><h2>{Title}</h2></div>{/block:Title}
<div class="caption">{Body}</div>
{/block:Text}
{block:Video}
<div class="video_post">
<figure><div class="embed">{Video-500}</div></figure>
{block:Caption}<div class="caption">{Caption}</div>{/block:Caption}
</div>
{/block:Video}
</div>
</article>
{/block:Posts}
The Javascript will generate hard-pixels for the left-margin, depending on the width of browser window. Change the hard pixels to 50%.
jQuery:
$(this).css("left", "50%");