Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- https://rectangleapp.com
- 프프로로그그래래밍
- 클튜구매
- querySelectAll
- form
- rectangleapp
- 클튜구독
- 클튜할인
- 구매
- 클립스튜디오할인
- js
- 클립스튜디오
- 맥
- 게임 맥에서
- 디자인표준계약서
- 형변환
- 클튜
- textContent
- 맥에서 게임
- Math.floor();
- 클립스튜디오구매
- 클립스튜디오구독
- 아이패드
- 애플
- 소수점이하버리기
- 배열
- 별찍어보기
- 객체
- 구독
- 서평단
Archives
- Today
- Total
duedue
클릭시 슬라이드이미지 본문
<style>
.slide {
margin: 0 auto;
border: 1px solid black;
width: 720px;
background-color: black;
}
img {
max-width: 100%;
}
.nav {
display: inline-block;
}
#prev{
float: left;
width: 40px;
height: 40px;
background: url(images/prev.png) no-repeat;
}
#next{
float: left;
width: 40px;
height: 40px;
background: url(images/next.png) no-repeat;
}
</style>
</head>
<body>
<section class="slide">
<div class="image_box">
<img id="main_image" src="images/image1.jpg">
</div>
<div class="tollba">
<div class="nav">
<div id="prev"></div>
<div id="next"></div>
</div>
</div>
</section>
<script>
var images =['images/image1.jpg','images/image2.jpg','images/image3.jpg','images/image4.jpg','images/image5.jpg']
var current = 0;
var changeImgaes = function(num){
if(current + num >=0 && current+num <images.length){
current +=num;
document.getElementById('main_image').src=images[current];
}
};
document.getElementById('prev').onclick =function(){
changeImgaes(-1);
};
document.getElementById('next').onclick =function(){
changeImgaes(1);
};
</script>
<style>
.slide {
margin: 0 auto;
border: 1px solid black;
width: 720px;
background-color: black;
}
img {
max-width: 100%;
}
.nav {
display: inline-block;
}
#prev{
float: left;
width: 40px;
height: 40px;
background: url(images/prev.png) no-repeat;
}
#next{
float: left;
width: 40px;
height: 40px;
background: url(images/next.png) no-repeat;
}
#page{
display: inline-block;
float: left;
float: left;
margin-top: 8px;
height: 32px;
color: white;
}
</style>
</head>
<body>
<section class="slide">
<div class="image_box">
<img id="main_image" src="images/image1.jpg">
</div>
<div class="tollba">
<div class="nav">
<div id="prev"></div>
<div id="page"></div>
<div id="next"></div>
</div>
</div>
</section>
<script>
var images =['images/image1.jpg','images/image2.jpg','images/image3.jpg','images/image4.jpg','images/image5.jpg']
var current = 0;
var pageNum = function(){
document.getElementById('page').textContent = (current+1)+'/'+images.length;
}
var changeImgaes = function(num){
if(current + num >=0 && current+num <images.length){
current +=num;
document.getElementById('main_image').src=images[current];
pageNum();
}
};
pageNum();
document.getElementById('prev').onclick =function(){
changeImgaes(-1);
};
document.getElementById('next').onclick =function(){
changeImgaes(1);
};
</script>