1<!-- https://codepen.io/poliweb/pen/eYJNqLM -->
2<!-- https://stackoverflow.com/questions/26377231/jquery-how-to-change-img-src-path-onclick -->
3
4<div class="img-container">
5 <img id="changeMe" src="">
6</div>
7
8<img class="preview" src="images/preview-1.jpg">
9<img class="preview" src="images/preview-2.jpg">
10<img class="preview" src="images/preview-2.jpg">
11
12 <!-- Script -->
13
14 $('.preview').on('click', function() {
15 $('#changeMe').prop('src', this.src);
16});
17
1// https://codepen.io/kman/pen/dXjpoX
2// Stockphotos JS
3
4$(document).ready(function(){
5 var flag = 0;
6 $("button#changeSize").click(function(){
7 if(flag == 0) {
8 $("#dummyimage").attr("src","http://dummyimage.com/350x155/");
9 flag = 1;
10 }
11 else if(flag == 1) {
12 $("#dummyimage").attr("src","http://dummyimage.com/450x255/");
13 flag = 0;
14 }
15 });
16});