Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

javascript doesn't move element

javascript doesn't move element

Problem

I'm trying make a click-able box to disable the transform CSS. I'm trying to overwrite the CSS with javascript but it dosn't seem to be working. I would like them to simply move to left and down a bit after clicking on the , where they would be if they just focused on the .

.bigbox {
border: 2px solid black;
border-radius:      20px;
background-color:   blue;
color:  white;
padding-left: 15px;
}
#closebigbox {
padding:    10px;
border: 2px solid black;
border-radius:      20px;
background-color:   blue;
color:  white;
font-size:  8px;
width:  25px;
text-align: left;
background-color:   silver;
}
.bigbox_submit{
padding:    3px;
border: 2px solid black;
border-radius:      20px;
background-color:   blue;
color:  white;
font-size:  12px;
width:  25px;
text-align: left;
background-color:   silver;
}

.bigbox{ 
 -moz-transition: all 0.5s ease-in-out; 
 } 
 .bigbox:focus { 
 background-color: #fc3; 
 -moz-transform: translate(125px,25px) scale(2); 
 }

Clear




Submit
`
Problem courtesy of: Cjueden

Solution

getElementsByClassName returns an Array so you'll need to loop through all of the elements and then apply the style:

var _elements = document.getElementsByClassName('bigbox');
for( var i = 0; i 
Solution courtesy of: locrizak

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

javascript doesn't move element

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×