Wordpress Plugin with Javascript

I am working on a wordpress plugin that allows the user to enter the image URL and konami code . When the code is entered with cones, the image appears, but I can’t revive it, I’m not familiar with jQuery and Javascript, and I’m just starting to learn it ... Any help would be fantastic!

<script type="text/javascript" charset="utf-8"> if ( window.addEventListener ) { var kkeys = [], konami = "{$this->opts['wpk_code']['current']}"; window.addEventListener("keydown", function(e){ kkeys.push( e.keyCode ); if ( kkeys.toString().indexOf( konami ) >= 0 ){ var elms=document.getElementById("konami").style; elms.display=(elms.display=="block")?"none":"block"; } }, true); } </script> 
+4
source share
2 answers

You have a game with some examples in jQuery animate () - they seem to do what you want.

+2
source

Try the following:

 $('#inputField').keyup(function () { if ($(this).val().length > 0) { $('#konami').animate({ opacity: 1, left: '50' }, 100); } else { $('#konami').animate({ opacity: 0, left: '0' }, 100); } }); 

HTML:

 <input type="text" id="inputField" /> <img src="..." id="konami" style="position:relative;" /> 
0
source

All Articles