samedi 28 mars 2015

HTML/CSS Image Rollover/Animation, specific case with existing code, how to change animation?

ok, I have don some web development in the past, but am fairly new to "css/webkit" animations.


I have an image on my website, that goes through an animation when a user "hovers" over the image, as so:


enter image description here


What I want to do is change this animation.


I want to remove the red "arrows" icon at the bottom-right. I think I want to keep the opacity transition, BUT, I want to display a DIFFERENT image, if the user is hovering over the image.


Here is the HTML code for the image:



<div class="col-md-4">

<div class="team" data-animation-name="fadeInRight">

<div class="team-photo">
<figure>
<img src="demo/team/dfds_seaways_ship.jpg" alt="">
<figcaption>
<a href="#">
<i class="gi gi-resize-full"></i>
</a>
</figcaption>
</figure>
</div>


I did not write this code, and so I am, unfortunately, quite lost.


I think I should show the "css-classes" used here.



/* ==========================================================================
Team
============================================================================= */
.team {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
margin-bottom: 30px;
}
.team .team-photo {
position: relative;
margin-bottom: 15px;
overflow: hidden;
}
.team .team-photo figcaption {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.5);
-webkit-transition: opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
transition: opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
opacity: 0;
}
.team .team-photo figcaption a {
display: block;
position: absolute;
z-index: 1;
width: 44px;
height: 44px;
overflow: hidden;
right: 0;
bottom: 0;
text-align: center;
text-decoration: none;
color: #fff;
background-color: #e35a55;
-webkit-transform-origin: 100%;
-moz-transform-origin: 100%;
-ms-transform-origin: 100%;
transform-origin: 100%;
-webkit-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
transition: -webkit-transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.team .team-photo figcaption a .fa,
.team .team-photo figcaption a .gi {
width: 44px;
height: 44px;
line-height: 44px;
font-size: 16px;
}
.team .team-photo figcaption a:hover {
background-color: #000;
}
.team:hover .team-photo figcaption,
.team.touch .team-photo figcaption {
opacity: 1;
}
.team:hover .team-photo figcaption a,
.team.touch .team-photo figcaption a {
-webkit-transform: rotate(0);
-ms-transform: rotate(0);
transform: rotate(0);


.team .team-info {
text-align: center;
padding: 0 15px;
}
.team .team-name {
margin: 0;
}
.team .team-data {
display: none;
}


I tried "just" adding onMouseOver and OnMouseOutEvents, allthough I am unsure if that would be the right/best way to do this, like so:



<img src="demo/team/dfds_seaways_ship.jpg" alt="" onmouseover="this.src='demo/team/dfds_seaways_ship2.jpg'" onmouseout="this.src='demo/team/dfds_seaways_ship.jpg'">


But it isn't working. This was my naive approach, with my web dev knowledge from a while ago, but I would like to do this by conforming to the CSS approach taken here by the developers of this site.


To be honest, I am lost, so if anyone can help me, or explain to me how I can do this easily with the CSS code that is available, I would be extremely happy, so I can get this done.


If more information is needed, let me know. And I hope the gif above (of the ship) displays fine, on my machine it doesn´t display correctly on IE, but on chrome it displays fine.


Thanks for any and all help!


C





Aucun commentaire:

Enregistrer un commentaire