제목은 기본적으로 모두를 말합니다.이미지 배열에서 이미지를 무작위로 변경
이미지 배열에서 임의의 이미지로 이미지를 변경하려고합니다. (희망적이라고 생각합니다.)
무언가를 클릭하면 어떻게 이미지 배열을 만든 다음 이미지를 임의 이미지로 변경할 수 있습니까? 이 example
<h1>These are just placeholders</h1>
<p>I just want these images to randomly change to an image from an array of images each time they are shown (when "display" isn't "none")</p>
<img src="https://pixabay.com/static/uploads/photo/2013/11/21/07/30/icon-214446_960_720.jpg" class="newsAD"></img>
<img src="https://pixabay.com/static/uploads/photo/2013/11/21/07/30/according-to-214445_960_720.jpg" class="newsAD"></img>
<style>
.newsAD {
width: 150px;
height: 150px;
margin-left: 50px;
background: skyblue;
cursor: default;
box-shadow: 1px 2px 5px 1px rgba(0, 0, 0, 0.4);
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js">
function changeImageToRandomImage() {
// something here that changes image to random image from array of images
}
</script>
을
HTML 때 디스플레이 ISN ' 아무것도? – Tonza
CSS와 같습니다. ('display : none') –