User:Toad64/Homepage: Difference between revisions

Jump to navigation Jump to search
Toad64 (talk | contribs)
replaced old .js code display with new .js
Toad64 (talk | contribs)
can this be code work on the hero page cards too? time to test
Line 1: Line 1:
<h3>Javascript code for herocards</h3>
<h3>Hero Card interaction with mouse</h3>
<p>Below here is the javascript code that is used for the HeroCards seen on the homepage:</p>
<p>This javascript code adds a listener to the <code>.HeroCard</code> element to allow the card the mouse is currently hovered over to tilt based on the mouse's location, relative to the center of the card:</p>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
document.querySelectorAll('.HeroCard').forEach(function(el) {
document.querySelectorAll('.HeroCard').forEach(function(el) {
Line 57: Line 57:
<p> You can see this code in action by clicking [https://deadlock.wiki/User:Toad64/Sandbox?withJS=User:Toad64/common.js Here] (desktop required).</p>
<p> You can see this code in action by clicking [https://deadlock.wiki/User:Toad64/Sandbox?withJS=User:Toad64/common.js Here] (desktop required).</p>
{{Deadlock Wiki/Heroes}}
{{Deadlock Wiki/Heroes}}
Using a similar code, this also works with the hero image card found on that Hero's wiki page:
<syntaxhighlight lang="javascript">
add new java script block here, if needed
</syntaxhighlight>
{{Infobox hero
| key = hero_unicorn
| voice_actor = <!--Natalie Lander (SPECULATION) -->
| release_date = February 9 2026
| codenames = Unicorn, Pepper
}}