|
|
| Line 17: |
Line 17: |
|
| |
|
|
| |
|
| $(document).ready(function() {
| | <script> |
| var mycanvas2 = document.getElementById("mw-Mycanvas2");
| | function changeImage() { |
| mycanvas2.style.width = "500px";
| | var image = document.getElementById("mw-Mycanvas2"); |
| mycanvas2.style.height = "300px";
| | if (image.src.match("20mmSoundKnot_TopSide.jpg")) { |
| mycanvas2.style.backgroundImage = 'url("https://simplywoodgrading.com/mediawiki/images/e/ea/20mmSoundKnot_TopSide.jpg?20230319084600")';
| | image.src = "https://simplywoodgrading.com/mediawiki/images/a/ab/20mmSoundKnot_ReededSide.jpg?20230319101142"; |
| mycanvas2.style.backgroundSize = "contain";
| | } else { |
| mycanvas2.style.backgroundRepeat = "no-repeat";
| | image.src = "https://simplywoodgrading.com/mediawiki/images/e/ea/20mmSoundKnot_TopSide.jpg?20230319084600"; |
| mycanvas2.style.backgroundPosition = "center";
| |
| mycanvas2.addEventListener("click", changeImage);
| |
| | |
| function changeImage() {
| |
| var image = document.getElementById("mw-Mycanvas2");
| |
| if (image.style.backgroundImage === 'url("https://simplywoodgrading.com/mediawiki/images/e/ea/20mmSoundKnot_TopSide.jpg?20230319084600")') {
| |
| image.style.backgroundImage = 'url("https://simplywoodgrading.com/mediawiki/images/a/ab/20mmSoundKnot_ReededSide.jpg?20230319101142")';
| |
| } else {
| |
| image.style.backgroundImage = 'url("https://simplywoodgrading.com/mediawiki/images/e/ea/20mmSoundKnot_TopSide.jpg?20230319084600")';
| |
| }
| |
| } | | } |
| }); | | } |
| | </script> |
|
| |
|
|
| |
|
| /*document.getElementById('mw-Mycanvas').innerHTML = '<canvas width="100" height="100" style="border:1px solid red;"></canvas>';*/ | | /*document.getElementById('mw-Mycanvas').innerHTML = '<canvas width="100" height="100" style="border:1px solid red;"></canvas>';*/ |