this is driving me crazy... can someone please tell me why the center column simply won't center in between the left and right columns? I'm trying to do that by using margin: 0 auto; on the center column.
$(document).ready(function(){
$("#hide-show").click(function(){
$("#panel").slideToggle();
});
});
.main-wrapper{
margin: 0 auto;
width: 70%;
}
#panel{
width: 100%;
background-color: aqua;
display: none;
position: relative;
float: left;
}
.wrapper{
width: 100%;
}
.images{
width: 100%;
}
#img-1{
background: url("http://lorempixel.com/output/people-q-c-640-480-1.jpg") no-repeat center;
background-size:contain;
height: 300px;
width: 100%;
}
.col {
width: 32%;
float: left;
overflow: hidden;
background: red;
border: 2px solid black;
}
.col:last-child{
float: right;
}
#testing{
background: yellow;
margin: 0 auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="main-wrapper">
<button id="hide-show" name="Click me">Click me</button>
<div id="panel">
<div class="wrapper">
<div class="col">
<p>Hello world! 2</p>
<div id="img-1" class="images"></div>
</div>
<div class="col" id="testing">
<p>Hello world! 3</p>
</div>
<div class="col">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit veniam quisquam, rem illum dicta cumque, voluptate fugiat impedit
beatae rerum ratione, voluptates nisi voluptate fugiat consectetur adipisicing elit. Suscipit veniam quisquam, rem illum dicta cumque,
voluptate fugiat impedit beatae rerum ratione, voluptates nisi voluptate fugiat consectetur adipisicing elit. Suscipit veniam quisquam,
rem illum dicta cumque, voluptate fugiat impedit beatae rerum ratione. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit veniam quisquam, rem illum dicta cumque, voluptate fugiat impedit
beatae rerum ratione, voluptates nisi voluptate fugiat consectetur adi</p>
</div>
</div>
</div>
<p>Hello world! 4</p>
</div>
Here I put a JSFiddle together: JSFiddle
Thank you!
floated elements don't behave well with others
as it's a 3 column output, however, it's an easy fix
in general:
html:
<div class='leftColumn col'> ... </div>
<div class='rightColumn col'> ... </div>
<div class='centerColumn col'> ... </div>
<div class='clearFloats'></div>
css
.col { width:32%; }
.leftColumn { float:left; }
.rightColumn { float:right; }
.centerColumn { margin:0 auto; }
.clearFloats { clear:both; font-size:0; line-height: 0; height:0;}
You'll notice the extra "clearFloats" div ... if you don't clear the floats, strange layout issues can happen (not in this case though, it seems) -
I've posted https://jsfiddle.net/97nbtgtb/1/ which changes your markup/css somewhat like above, didn't add any clearing div, and just changed the css to effectively give the center col no float
margin: 0 auto; will not work here since you have float: left; here.
Increase width of the column to 33.33%. and add box-sizing: border-box;
.col {
width: 33.33%;
float: left;
overflow: hidden;
background: red;
border: 2px solid black;
box-sizing: border-box;
}
I changed your float:left to display:inline-block;
$(document).ready(function() {
$("#hide-show").click(function() {
$("#panel").slideToggle();
});
});
.main-wrapper {
margin: 0 auto;
width: 70%;
}
#panel {
width: 100%;
background-color: aqua;
display: none;
position: relative;
float: left;
}
.wrapper {
width: 100%;
height: 800px;
}
.images {
width: 100%;
}
#img-1 {
background: url("http://lorempixel.com/output/people-q-c-640-480-1.jpg") no-repeat center;
background-size: contain;
height: 300px;
width: 100%;
}
.col {
width: 32%;
height: 100%;
display: inline-block;
overflow: hidden;
background: red;
border: 2px solid black;
}
.col:last-child {
float: right;
}
#testing {
background: yellow;
margin-left: auto;
margin-right: auto;
}
<div class="main-wrapper">
<button id="hide-show" name="Click me">Click me</button>
<div id="panel">
<div class="wrapper">
<div class="col">
<p>Hello world! 2</p>
<div id="img-1" class="images"></div>
</div>
<div class="col" id="testing">
<p>Hello world! 3</p>
</div>
<div class="col">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit veniam quisquam, rem illum dicta cumque, voluptate fugiat impedit beatae rerum ratione, voluptates nisi voluptate fugiat consectetur adipisicing elit. Suscipit veniam quisquam,
rem illum dicta cumque, voluptate fugiat impedit beatae rerum ratione, voluptates nisi voluptate fugiat consectetur adipisicing elit. Suscipit veniam quisquam, rem illum dicta cumque, voluptate fugiat impedit beatae rerum ratione. Lorem ipsum
dolor sit amet, consectetur adipisicing elit. Suscipit veniam quisquam, rem illum dicta cumque, voluptate fugiat impedit beatae rerum ratione, voluptates nisi voluptate fugiat consectetur adi</p>
</div>
</div>
</div>
<p>Hello world! 4</p>
</div>
So apparently you can't use margin: auto; on floating elements. The answer to this particular case was to add a float: none; the CSS rule for the middle column as JaromandaX stated in the comments. Thanks for the help guys!
Related
I have two div's float left and right. In the left div there is an image, and in the right div there are paragraphs. The image in the left div is hidden, when I hover the right div the image should be displayed but I can't do this, there is a problem when I attempt to do this.
.lower-container {
padding: 10px;
width: 100%;
text-align: center;
margin-bottom: -70px;
}
.left-logo-container {
width: 40%;
float: left;
padding: 10px;
padding-top: 0 !important;
}
.left-logo-container img {
width: 250px;
padding-bottom: 50px;
}
.right-para-container {
width: 60%;
float: right;
padding: 10px;
margin-top: -200px;
}
.right-para-container p {
color: white;
text-align: left;
padding-left: 0;
padding-right: 120px;
font-family: oh-whale;
}
.clear:after {
clear: both;
content: "";
display: table;
}
/* Display element on hovering */
.hide {
display: none;
}
.myDIV:hover+.hide {
display: block;
}
<section id="welcome_cryptonic_06">
<div class="container">
<div class="vision-container">
<div class="title-container">
</div>
<div class="lower-container">
<div class="left-logo-container myDIV">
<img src="about_image.png">
</div>
<div class="right-para-container hide">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores provident ipsum veritatis quod eveniet aperiam ipsa voluptatibus mollitia deserunt eos itaque assumenda omnis nam animi consequuntur voluptate, placeat velit repudiandae. Lorem, ipsum dolor
sit amet consectetur adipisicing elit. Fugiat, veritatis? Iure dolor consequatur possimus ipsum tenetur quos tempora animi numquam inventore. Pariatur doloremque ut deleniti fugiat enim, laudantium culpa sit.
</p>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>
</section>
<!-- End welcome_cryptonic -->
Here is the solution !
Run the code in a full screen.
.lower-container {
display: flex;
flex-wrap:wrap;
padding:5rem;
height:20%;
}
.left-logo-container {
order:1;
height:20rem !important;
padding:2rem;
}
.left-logo-container img{
height:20rem;
width:auto;
}
.right-para-container {
order:2;
height:25%
color: black;
width:50%;
text-align: left;
font-family: oh-whale;
padding:5rem;
}
.right-para-container p{
border:2px solid grey;
border-radius:2rem;
padding:2rem;
}
#show {
display: none
}
#main:hover + #show {
display: block
}
<section id="welcome_cryptonic_06">
<div class="container">
<div class="vision-container">
<div class="title-container">
</div>
<div class="lower-container">
<div class="right-para-container " id='main'>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores provident ipsum veritatis quod eveniet aperiam ipsa voluptatibus mollitia deserunt eos itaque assumenda omnis nam animi consequuntur voluptate, placeat velit repudiandae. Lorem, ipsum dolor
sit amet consectetur adipisicing elit. Fugiat, veritatis? Iure dolor consequatur possimus ipsum tenetur quos tempora animi numquam inventore. Pariatur doloremque ut deleniti fugiat enim, laudantium culpa sit.
</p>
</div>
<div class="left-logo-container " id='show'>
<img src="https://images.unsplash.com/photo-1655833266283-af4002bf9ebb?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw1fHx8ZW58MHx8fHw%3D&auto=format&fit=crop&w=500&q=60">
</div>
</div>
</div>
</div>
</section>
I just stuck in position, I used position:relative for parent and position:absolute for child now parent div did't get height and i don't want to use min-height or height. You can see the red border on top which is the parent div border.
fiddle code
.box {
text-align: center;
border: 1px solid red;
width: 500px;
margin: 0 auto;
position: relative;
}
.content {
width: 50%;
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
}
<div class="box">
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda adipisci vel, dolore aspernatur iste iure blanditiis quam esse repudiandae aperiam debitis doloribus necessitatibus placeat tempora voluptate totam exercitationem neque quae.
</div>
</div>
Help me please ?
Thanks
You could just make the outer box absolute, if your textbos has to be positioned absolute.
EDIT: Without being able to edit the HTML structure, you need specific heights or some JavaScript. More Information about position
.box {
text-align: center;
border: 1px solid red;
width: 500px;
margin: 0 auto;
position: absolute;
}
.content {
width: 50%;
left: 0;
right: 0;
margin: 0 auto;
}
<div class="box">
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda adipisci vel, dolore aspernatur iste iure blanditiis quam esse repudiandae aperiam debitis doloribus necessitatibus placeat tempora voluptate totam exercitationem neque quae.
</div>
</div>
Its not possible without javascript but you can get this if add a child element inside the '.content'...
.box {
text-align: center;
width: 500px;
margin: 0 auto;
position:relative;
}
.content {
border: 1px solid red;
width: 100%;
position:absolute;
left:0;
right:0;
}
.inner{
margin: 0 auto;
width: 50%;
}
<div class="box">
<div class="content">
<div class="inner">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda adipisci vel, dolore aspernatur iste iure blanditiis quam esse repudiandae aperiam debitis doloribus necessitatibus placeat tempora voluptate totam exercitationem neque quae.
</div>
</div>
</div>
Absolute positioning takes an element out of normal flow, so it can not change the measures of its parent any more. Try this, it works fine:
.box {
text-align: center;
border: 1px solid red;
width: 500px;
height:100%;
margin: 0 auto;
}
.content {
width: 50%;
margin: 0 auto;
}
I've been trying different ways but couldn't achieve what I want.
<div id="parent">
<div id="child-1"></div>
<div id="child-2"></div>
<div id="child-3"></div>
</div>
So I have the #parent at height: 100vh.
#child-1 should have height: 100% of parent.
#child-2 and #child-3 should have width: 100% and height: auto and they should be stacked on top of each other at position bottom: 0.
I've been trying to set parent relative and two childs absolute but the first child's height gets ignored.. I tried with display flex but first child's height is not 100% of parent.. I'm very confused how to do this.
Can someone help?
Here is what I'm trying to achieve: jsfiddle.net
You have to first get the bottom value of #child-2 dynamically as you said it should be on the top of #child-3.
You need to apply jQuery to get the height of #child-3 dynamically and then applying the height value of #child-3 to the bottom value of child-2, just like
#child-2 {
bottom: height-of-child-3;
}
Look at this Codepen
Or look at the snippet below:
height_child_three = $('#child-3').height();
$('#child-2').css({
position: 'absolute',
bottom: height_child_three
});
#parent {
width: 100vw;
height: 100vh;
background: #000;
position: relative;
}
#child-1 {
width: 100%;
height: 100%;
background: #eee;
}
#child-2 {
width: 100%;
background: #a0ea0e;
}
#child-3 {
position: absolute;
bottom: 0;
width: 100%;
background: #30e30e;
}
body { margin: 0; } /* A small reset */
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="parent">
<div id="child-1">
<strong>I'm child 1</strong>
</div>
<div id="child-2">
<strong>I'm child 2</strong>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ratione deleniti voluptate commodi distinctio, repellendus qui, placeat laboriosam eligendi! Ducimus reiciendis officiis debitis placeat adipisci quae hic tempore vitae suscipit nemo.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam sed aliquid, laborum nisi quos excepturi hic! Molestias hic consectetur dolor! Perferendis iste, quisquam quaerat ab, odio ducimus! Odio, minima error?</p>
</div>
<div id="child-3">
<strong>I'm child 3</strong>
</div>
</div>
Hope this helps!
Is this what you need?
HTML:
<div id="parent">
<div class="child-1"></div>
<div class="child-2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error voluptatum necessitatibus dolorem soluta laudantium cupiditate maiores neque, aliquid accusamus autem saepe tempora, itaque possimus, eaque deleniti odio atque enim omnis.</div>
<div class="child-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Culpa, illo est dolor dolores placeat deleniti quae consequuntur eum ipsum blanditiis laboriosam quod repellendus fugit! Odio quis rem vel a dolores.</div>
</div>
CSS:
html,
body,
div {
margin: 0;
padding: 0;
}
*,
*:after,
*:before {
box-sizing: border-box;
}
#parent {
position: relative;
width: 100vw;
height: 100vh;
background: #ccc;
}
.child-1 {
width: 100%;
height: 100%;
background: red;
}
.child-2 {
width: 100%;
height: auto;
padding: 30px;
background: blue;
}
.child-3 {
width: 100%;
height: auto;
padding: 30px;
background: green;
}
Here you can see a solution just using plain CSS. CODEPEN
I've been creating a grid, which uses padding for gutters. There's times where It's necessary to have no gutters (full width image) so I simply created a class which removed the padding.
The problem is, when using a 50% width, even though it's using border-box, is not truly 50%.
a reduced test case:
JsFiddle
Code
*,
*:before,
*:after {
box-sizing: border-box;
}
.row {
zoom: 1;
&: before, &: after {
content: "";
display: table;
}
&:after {
clear: both;
}
}
.half {
width: 50%;
padding: 10px;
}
.no-pad {
padding: 0;
}
.column {
float: left;
}
img {
max-width: 100%;
height: 100%;
display: block;
}
.eq-height-container {
display: flex;
}
.eq-height-column {
flex: 1;
}
<div class="row eq-height-container">
<div class="column half eq-height-column" style="background-color: red;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa necessitatibus qui ea, quasi pariatur sed esse beatae porro in temporibus ipsum delectus, quisquam. Saepe sapiente, facere repellat tenetur quae aut.</p>
</div>
<div class="column half no-pad eq-height-column">
<img src="http://lorempixel.com/400/200" alt="">
</div>
</div>
<div class="row eq-height-container">
<div class="column half no-pad eq-height-column">
<img src="http://lorempixel.com/400/200" alt="">
</div>
<div class="column half eq-height-column" style="background-color: red;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa necessitatibus qui ea, quasi pariatur sed esse beatae porro in temporibus ipsum delectus, quisquam. Saepe sapiente, facere repellat tenetur quae aut.</p>
</div>
</div>
Is there a simple way around this?
you can set img to width:100% and remove flex:1 and float:left as well if you want to keep display:flex for equal height
body {
margin: 0
}
*,
*:before,
*:after {
box-sizing: border-box;
}
.row::before,
.row::after {
content: "";
display: table;
}
.row::after {
clear: both;
}
.half {
width: 50%;
padding: 10px;
background: red
}
.no-pad {
padding: 0;
}
img {
width: 100%;
height: 100%;
display: block;
}
.eq-height-container {
display: flex;
}
.eq-height-column {
/* flex: 1;*/
}
<div class="row eq-height-container">
<div class="column half eq-height-column">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa necessitatibus qui ea, quasi pariatur sed esse beatae porro in temporibus ipsum delectus, quisquam. Saepe sapiente, facere repellat tenetur quae aut.</p>
</div>
<div class="column half no-pad eq-height-column">
<img src="//lorempixel.com/400/200" alt="">
</div>
</div>
<div class="row eq-height-container">
<div class="column half no-pad eq-height-column">
<img src="//lorempixel.com/400/200" alt="">
</div>
<div class="column half eq-height-column">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa necessitatibus qui ea, quasi pariatur sed esse beatae porro in temporibus ipsum delectus, quisquam. Saepe sapiente, facere repellat tenetur quae aut.</p>
</div>
</div>
That's because you're mixing in flex. If you remove .eq-height-column you'll see that the two columns become the same width.
I have 4 columns in which I have images with different sizes followed by a absolutely positioned mask, appearing on hover.
The width of mask exceeds the images
How can I set the mask always the same width as the width of the image?
https://jsfiddle.net/tsjzrmra/2/
HTML
<div class="wrap"><div class="row">
<div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/100X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
<div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/120X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
<div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/150X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
<div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/180X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
CSS
* { box-sizing: border-box; }
.wrap{
width: 87%;
margin: auto;
padding: 0 10px;
background-color: rgba(255,255,255,0.9);
overflow: hidden;
box-shadow: 0 0 5px #eee;
}
img{
max-width: 100%;
height: auto;
}
[class*='col-']{
float:left;
}
.col-1-3{
width: 33.33%;
padding: 20px;
}
.col-2-3{
width: 66.66%;
padding: 20px;
}
.col-1-4{
width: 25%;
padding: 10px;
}
.show{
width:100%;
height: 100%;
border: 1px solid rgba(0,0,0,0.04);
overflow: hidden;
position: relative;
text-align: center;
cursor: default;
background: #fff;
display: block;
border-radius: 4px;
}
.show .mask{
width: 100%;
height: 100%;
position: absolute;
overflow: hidden;
top: 0;
left: 0
}
.show-first .mask {
opacity: 0;
background-color: rgba(0,0,0, 0.4);
transition: all 0.4s ease-in-out;
}
.show-first:hover .mask {
opacity: 1;
}
#media only screen and (max-width: 767px){
.col-1-4{
width: 50%;
padding: 10px;
overflow: hidden;
clear: right;
}
.wrap{
width: 100%;
margin: auto;
overflow: hidden;
}
.mobile-clear{
clear:both;
}
}
Add a div wrapper around the content:
<div class="show show-first">
<div class="mask-wrapper">
<img src="http://placehold.it/100X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
then update the CSS
.mask-wrapper: {
position: relative;
display: inline-block;
}
.show {
text-align: center;
}
.mask {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 2;
}
img {
max-width: 100%; // it's better to change it into a class instead
}
Answer
You may simply remove this definition:
width: 100%;
and edit this one
display: block;
into
display: inline-block
for <div class="show">. Also if you want the <div class="show">s to have center aligned, you need to add
text-align: center;
to <div class="col-1-4">.
In action:
* {
box-sizing: border-box;
}
.wrap{
width: 87%;
margin: auto;
padding: 0 10px;
background-color: rgba(255,255,255,0.9);
overflow: hidden;
box-shadow: 0 0 5px #eee;
}
img{
max-width: 100%;
height: auto;
}
[class*='col-']{
float:left;
}
.col-1-3{
width: 33.33%;
padding: 20px;
}
.col-2-3{
width: 66.66%;
padding: 20px;
}
.col-1-4{
width: 25%;
padding: 10px;
text-align: center;
}
.show{
height: 100%;
border: 1px solid rgba(0,0,0,0.04);
overflow: hidden;
position: relative;
text-align: center;
cursor: default;
background: #fff;
display: inline-block;
border-radius: 4px;
}
.show .mask{
width: 100%;
height: 100%;
position: absolute;
overflow: hidden;
top: 0;
left: 0
}
.show-first .mask {
opacity: 0;
background-color: rgba(0,0,0, 0.4);
transition: all 0.4s ease-in-out;
}
.show-first:hover .mask {
opacity: 1;
}
#media only screen and (max-width: 767px) {
.col-1-4{
width: 50%;
padding: 10px;
overflow: hidden;
clear: right;
}
.wrap{
width: 100%;
margin: auto;
overflow: hidden;
}
.mobile-clear{
clear:both;
}
}
<div class="wrap">
<div class="row">
<div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/100X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
<div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/120X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div><div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/150X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div><div class="col-1-4">
<div class="show show-first">
<img src="http://placehold.it/180X200" />
<div class="mask">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi sequi laboriosam delectus ipsa, vel nulla ipsum quod esse molestias nam quos eius. Reprehenderit repellat atque voluptas autem velit, distinctio esse.
</div>
</div>
</div>
</div>
</div>
try this script,
$('.show').hover(function(){
var getimg = $(this).find('img').width();
//alert(getimg);
$('.mask').css({'width':getimg})
});
Try this Demo