<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>Document</title>
<script>
$(function() {
$('#control a').click(function() {
$(this).addClass('on').siblings().removeClass('on');
let num = $(this).index();
console.log(num);
$('#pic > div').filter(':visible').stop(true).fadeOut(350);
$('#pic > div').eq(num).stop(true).fadeIn(350);
});
$('#control a:first').addClass('on');
$('#pic > div:first').show();
});
</script>
<style>
* {
margin: 0; padding: 0;
}
li {
list-style: none;
}
a {
font-family: "돋움"; font-size: 12px; color: #000; text-decoration: none;
}
#visual {
width: 1000px; margin: 0 auto; position: relative;
}
#pic {
height: 563px; overflow: hidden; position: relative; box-sizing: 1px 5px 10px;
}
#pic > div {
position: absolute; left: 0; top: 0; display: none;
}
#control {
position: absolute; width: 100%; left: 0; bottom: 30px; text-align: center;
}
#control a {
display: inline-block; width: 26px; height: 26px; background: #000; line-height: 26px; font-size: 0.8em; border-radius: 14px; margin: 0 2px;
}
#control a.on {
background: #ff6600;
}
</style>
</style>
</head>
<body>
<div id="visual">
<div id="pic">
<div><a href="#"><img src="../img/f1.jpg" alt="1"></a></div>
<div><a href="#"><img src="../img/f2.jpg" alt="2"></a></div>
<div><a href="#"><img src="../img/f3.jpg" alt="3"></a></div>
<div><a href="#"><img src="../img/f4.jpg" alt="4"></a></div>
</div>
<div id="control">
<a href="javascript:;">1</a>
<a href="javascript:;">2</a>
<a href="javascript:;">3</a>
<a href="javascript:;">4</a>
</div>
</div>
</body>
</html>