I am going to use a button I found online:
http://codepen.io/ibrahimjabbari/pen/ulbek
After clicking it, it doesn't reset to the original state, how would I do this?
<nav class="ij-effect-2">
When you click elsewhere on the page it causes it to reset to original state but I want this done automaticly after being clicked
Well I might have a solution:
function fireClick(node){
if ( document.createEvent ) {
var evt = document.createEvent('MouseEvents');
evt.initEvent('click', true, false);
node.dispatchEvent(evt);
} else if( document.createEventObject ) {
node.fireEvent('onclick') ;
} else if (typeof node.onclick == 'function' ) {
node.onclick();
}
}
Using this you can fire a click by calling click on body. With fireClick(document.body)
. Source: http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.