Created
May 20, 2022 15:45
-
-
Save techhjork/b5e22e794e3652693a62917042cad74e to your computer and use it in GitHub Desktop.
Transition issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>product</title> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | |
<style type="text/css"> | |
.imgs{ | |
-webkit-transition: all .5s ease-in; | |
-webkit-transition: all .5s ease-out; | |
-moz-transition: all .5s ease-in; | |
-moz-transition: all .5s ease-out; | |
-o-transition: all .5s ease-in; | |
-o-transition: all .5s ease-out; | |
} | |
.change{ | |
-webkit-transition: all .5s ease-in; | |
-webkit-transition: all .5s ease-out; | |
-moz-transition: all .5s ease-in; | |
-moz-transition: all .5s ease-out; | |
-o-transition: all .5s ease-in; | |
-o-transition: all .5s ease-out; | |
box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.2); | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<h1 style="background: gray;height: 150px;color: white;">My products</h1> | |
<div class="row align-items-center justify-center"> | |
<div class="col-xl-3 col-md-6 col-12 m-2" style="width: 200px; height: 300px;"> | |
<img style="object-fit: cover;" src ='https://images.unsplash.com/photo-1650612346320-85952aea0085?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzMzc&ixlib=rb-1.2.1&q=80' data-src1="https://images.unsplash.com/photo-1650612346320-85952aea0085?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzMzc&ixlib=rb-1.2.1&q=80" data-src2="https://images.unsplash.com/photo-1652207168418-ed49bcec2e22?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzMzc&ixlib=rb-1.2.1&q=80" width=100% height=100% class="imgs"> | |
</div> | |
<div class="col-xl-3 col-md-6 col-12 m-2" style="width: 200px; height: 300px;"> | |
<img style="object-fit: cover;" src ='https://images.unsplash.com/photo-1651769851983-6cd09ee1077e?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzMzc&ixlib=rb-1.2.1&q=80' data-src1="https://images.unsplash.com/photo-1652891179429-cfcabfa6e16c?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzMzc&ixlib=rb-1.2.1&q=80" data-src2="https://images.unsplash.com/photo-1651275001129-e8e4fbba075d?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzMzc&ixlib=rb-1.2.1&q=80" width=100% height=100% class="imgs"> | |
</div> | |
<div class="col-xl-3 col-md-6 col-12 m-2" style="width: 200px; height: 300px;"> | |
<img style="object-fit: cover;" src ='https://images.unsplash.com/photo-1564038079594-99ba184fd036?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzOTg&ixlib=rb-1.2.1&q=80' data-src1="https://images.unsplash.com/photo-1564038079594-99ba184fd036?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzOTg&ixlib=rb-1.2.1&q=80" data-src2="https://images.unsplash.com/photo-1514846326710-096e4a8035e0?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzOTg&ixlib=rb-1.2.1&q=80" width=100% height=100% class="imgs"> | |
</div> | |
<div class="col-xl-3 col-md-6 col-12 m-2" style="width: 200px; height: 300px;"> | |
<img style="object-fit: cover;" src ='https://images.unsplash.com/photo-1541257710737-06d667133a53?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzOTg&ixlib=rb-1.2.1&q=80' data-src1="https://images.unsplash.com/photo-1541257710737-06d667133a53?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzOTg&ixlib=rb-1.2.1&q=80" data-src2="https://images.unsplash.com/photo-1545912453-db258ca9b7b7?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTMwNjEzOTg&ixlib=rb-1.2.1&q=80" width=100% height=100% class="imgs"> | |
</div> | |
</div> | |
</div> | |
<br> | |
</div> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
// $(".imgs").each(function(i,el){ | |
// $(this).mouseenter(function(){ | |
// $(this).addClass("change").delay(500).attr("src",$(this).attr("data-src2")).queue(function() { | |
// $(this).removeClass("change").dequeue(); | |
// }); | |
// }).mouseleave(function(){ | |
// $(this).addClass("change").delay(500).attr("src",$(this).attr("data-src1")).queue(function() { | |
// $(this).removeClass("change").dequeue(); | |
// }) | |
// }) | |
// }) | |
$(".imgs").each(function(i,el){ | |
$(this).mouseenter(function(){ | |
$(this).attr("src",$(this).attr("data-src2")) | |
}).mouseleave(function(){ | |
$(this).attr("src",$(this).attr("data-src1")) | |
}) | |
}) | |
// $('.imgs').hover(function () { | |
// $('#img1').attr('src',"" ) | |
// $('#img1').css({ | |
// "box-shadow": "5px 10px 12px 6px, 0 0 5px 8px gray", | |
// "color": "gray" | |
// }); | |
// }, | |
// function () { | |
// $('#img1').attr('src', "") | |
// $('#img1').css({ | |
// "box-shadow": "5px 10px 12px 6px white, 0 0 5px 8px white" | |
// }); | |
// }); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment