html - Autofocus won't apply to input box -
i'm trying autofocus input box, that's appears when 'get started' pressed:
<input name="hex" type="search" autofocus="autofocus">
however, after applying autofocus="autofocus"> in input doesn't apply.
i have tried give input id , used jquery:
$('input').focus();
but again, does't seem apply, can help?
basically happening is focusing though when click button unfocuses when overlay comes down when on no longer focused.
the way round add:
$('input').focus();
when animation of overlay coming down on button click
change contents of demo1.js this:
(function() { var triggerbttn = document.getelementbyid( 'trigger-overlay' ), overlay = document.queryselector( 'div.overlay' ), closebttn = overlay.queryselector( 'button.overlay-close' ); transendeventnames = { 'webkittransition': 'webkittransitionend', 'moztransition': 'transitionend', 'otransition': 'otransitionend', 'mstransition': 'mstransitionend', 'transition': 'transitionend' }, transendeventname = transendeventnames[ modernizr.prefixed( 'transition' ) ], support = { transitions : modernizr.csstransitions }; function toggleoverlay() { if( classie.has( overlay, 'open' ) ) { classie.remove( overlay, 'open' ); classie.add( overlay, 'close' ); var onendtransitionfn = function( ev ) { if( support.transitions ) { if( ev.propertyname !== 'visibility' ) return; this.removeeventlistener( transendeventname, onendtransitionfn ); } classie.remove( overlay, 'close' ); }; if( support.transitions ) { overlay.addeventlistener( transendeventname, onendtransitionfn ); } else { onendtransitionfn(); } } else if( !classie.has( overlay, 'close' ) ) { classie.add( overlay, 'open' ); $('input').focus(); } } triggerbttn.addeventlistener( 'click', toggleoverlay ); closebttn.addeventlistener( 'click', toggleoverlay ); })();
Comments
Post a Comment