Hello, there is a slide show with autoscrolling of pictures, and there is a separate block in which circles are located that show which picture is on the screen now. But the problem is that I can not place these circles right on the pictures, placed them in different places, the screenshot shows the best version I have achieved. The problem is that there is no overlap, the picture narrows in height, and I would like the circles to be below and not on top like mine. And one more problem, when I replace the black color in the rds with the picture, the picture is not displayed, the background disappears and only the circles remain.
html code:
<?php Header("Content-Type: text/html; charset=utf-8");?> <!DOCTYPE HTML> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <head> <meta charset="utf-8"> <link rel="icon" href="images/icon.png" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="index-css.css"> <link rel="stylesheet" type="text/css" href="container/swap.css"> <script> window.onload = function() { gallery.init(5); } </script> </head> <body> <div id="wrapper"> <div id="container"> <div class="clear"></div> <div class="rds" onclick="gallery.slide(event)"> <span class="rds-bl" id="btn1"></span> <span class="rds-bl" id="btn2"></span> <span class="rds-bl" id="btn3"></span> <span class="rds-bl" id="btn4"></span> <span class="rds-bl" id="btn5"></span> </div> <div class="photo"> <div class="container-photo" id="container_image"> <div class="image-block"> <span><img src="container/images/1.png" /></span> </div> <div class="image-block"> <span><img src="container/images/2.png" /></span> </div> <div class="image-block"> <span><img src="container/images/3.png" /></span> </div> <div class="image-block"> <span><img src="container/images/4.png" /></span> </div> <div class="image-block"> <span><img src="container/images/5.png" /></span> </div> <div class="clear"></div> </div> </div> </div> </div> <script type="text/javascript" src="container/swap.js"></script> </body> </HTML> css code:
#container { position: absolute; margin: 0 auto; width: 780px; height: 280px; padding: 0; z-index: 2; } .photo { float: left; width: 780px; height: 280px; overflow: hidden; } .container-photo { width: 780px; height: 280px; -webkit-transition: all 1s; transition: all 1s; position: relative; } .image-block { width: 780px; height: 280px; float: left; background: pink; } .clear { clear: both; } .rds { display: block; line-height: 150%; width: 780px; text-align: center; background-color: black; z-index: 3; } .rds-bl { width: 10px; height: 10px; cursor: pointer; margin: 4px; margin-bottom: 0px; background-image: gray; display: inline-block; border-radius: 50%; z-index: 4; } js code:
var gallery = { cnt: 0, container: document.getElementById("container_image"), timer: null, rds: "btn1", pos: 0, top: 1, init: function(i) { this.cnt = i; this.container.style.width = i * 780 + "px"; this.timer = setInterval(function() { gallery.start(); }, 4000); }, start: function() { if (this.top == 1) { this.pos = 0; this.top += 1; document.getElementById("btn1").style.backgroundColor = "white"; document.getElementById("btn2").style.backgroundColor = "gray"; document.getElementById("btn3").style.backgroundColor = "gray"; document.getElementById("btn4").style.backgroundColor = "gray"; document.getElementById("btn5").style.backgroundColor = "gray"; } else if (this.top == 2) { this.pos -= 390 * 2; this.top += 1; document.getElementById("btn1").style.backgroundColor = "gray"; document.getElementById("btn2").style.backgroundColor = "white"; document.getElementById("btn3").style.backgroundColor = "gray"; document.getElementById("btn4").style.backgroundColor = "gray"; document.getElementById("btn5").style.backgroundColor = "gray"; } else if (this.top == 3) { this.pos -= 390* 2; this.top += 1; document.getElementById("btn1").style.backgroundColor = "gray"; document.getElementById("btn2").style.backgroundColor = "gray"; document.getElementById("btn3").style.backgroundColor = "white"; document.getElementById("btn4").style.backgroundColor = "gray"; document.getElementById("btn5").style.backgroundColor = "gray"; } else if (this.top == 4) { this.pos -= 390 * 2; this.top += 1; document.getElementById("btn1").style.backgroundColor = "gray"; document.getElementById("btn2").style.backgroundColor = "gray"; document.getElementById("btn3").style.backgroundColor = "gray"; document.getElementById("btn4").style.backgroundColor = "white"; document.getElementById("btn5").style.backgroundColor = "gray"; } else if (this.top == 5) { this.pos -= 390 * 2; this.top = 1; document.getElementById("btn1").style.backgroundColor = "gray"; document.getElementById("btn2").style.backgroundColor = "gray"; document.getElementById("btn3").style.backgroundColor = "gray"; document.getElementById("btn4").style.backgroundColor = "gray"; document.getElementById("btn5").style.backgroundColor = "white"; } this.container.style.left = this.pos + "px"; }, slide: function(event) { var e = event || window.event; var target = e.target; if (target.tagName.toLowerCase() != "span") return; var id_click = target.id; var pos = document.getElementById(id_click).offsetLeft; if (id_click == "btn1") pos = 0; else if (id_click == "btn2") pos -= 571.5 * 2; else if (id_click == "btn3") pos -= 648.5 * 3; else if (id_click == "btn4") pos -= 730 * 4; else if (id_click == "btn5") pos -= 745 * 5; else pos = 247; this.container.style.left = pos + "px"; } } 