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:
Posts (Atom)
The Elder Scrolls: Oblivion - 2023 Experience
This article is a WIP. Setting up Oblivion in 2023 on a Steam Deck (w/ SteamOS) Install from Steam Vortex Experience (post base mod tools...
-
[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...
-
[Part 1] [Part 2] [Part 3] Part 1 covered the primary goal of DevOps: Communication. Part 2: Routine & Consistency Establish daily ...