Simple/Easy JS Click image switcher
This is pretty raw b/c out-of-the-box, Blogger doesn't support code blocks... but this is better than the empty page that existed.
onImg and offImg represent the on/off versions 
onClick is a ternary expression that looks as the src filename, and replaces its value with the not-selected filename. 
Pretty simple actually, but shows off the power of a simple ternary expression in JavaScript.
<script>
var onImg= "on.jpg";
var offImg= "off.jpg";
</script>
<img src="on.jpg" onclick="this.src = this.src == offImg ? onImg : offImg;"/>Pretty simple actually, but shows off the power of a simple ternary expression in JavaScript.
Subscribe to:
Comments (Atom)
VS Code + Azure DevOps Pipelines
Update your settings.json to include this file association: "files.associations" : { "*pipeline*.yaml" : "az...
- 
I recently had to install Ubuntu Desktop on a laptop that had a problematic NVidia chipset: The system would always freeze in a very short ...
- 
[Part 1] [Part 2] [Part 3] Distractions Home distractions are very different than office workplace distractions because they are much mo...
- 
[Part 1] [Part 2] [Part 3] I usually refrain from mentioning current and previous positions I've held and will continue to do so. This...