Basit Slider Uygulaması
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<style>
img{
width: 100vw;
height: 50vh;
position: absolute;
left: 0;
}
</style>
</head>
<body>
<img src="https://fakeimg.pl/100x100/515151/?text=5" alt="" onclick="Gizle(this)" id="resim4">
<img src="https://fakeimg.pl/100x100/8bac51/?text=4" alt="" onclick="Gizle(this)" id="resim3">
<img src="https://fakeimg.pl/100x100/5a27bc/?text=3" alt="" onclick="Gizle(this)" id="resim2">
<img src="https://fakeimg.pl/100x100/ffff00/?text=2" alt="" onclick="Gizle(this)" id="resim1">
<img src="https://fakeimg.pl/100x100/ffaa00/?text=1" alt="" onclick="Gizle(this)" id="resim0">
</body>
<script>
function Gizle(resim){
let sol = 0;
setInterval(function(){
sol+= 50;
if(sol > window.width){
clearInterval();
}
resim.style.left = sol+'px';
},10)
}
</script>
</html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<style>
img{
width: 100vw;
height: 50vh;
position: absolute;
left: 0;
}
</style>
</head>
<body>
<img src="https://fakeimg.pl/100x100/515151/?text=5" alt="" onclick="Gizle(this)" id="resim4">
<img src="https://fakeimg.pl/100x100/8bac51/?text=4" alt="" onclick="Gizle(this)" id="resim3">
<img src="https://fakeimg.pl/100x100/5a27bc/?text=3" alt="" onclick="Gizle(this)" id="resim2">
<img src="https://fakeimg.pl/100x100/ffff00/?text=2" alt="" onclick="Gizle(this)" id="resim1">
<img src="https://fakeimg.pl/100x100/ffaa00/?text=1" alt="" onclick="Gizle(this)" id="resim0">
</body>
<script>
function Gizle(resim){
let sol = 0;
setInterval(function(){
sol+= 50;
if(sol > window.width){
clearInterval();
}
resim.style.left = sol+'px';
},10)
}
</script>
</html>
Yorumunuzu Ekleyin