Team:UANL Mty-Mexico/test1

From 2013.igem.org

Revision as of 01:45, 27 August 2013 by Quintero (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

/*

* Strapping-specific scripts
*/

jQuery(function($) {

 var $nav = $('#page-header ul.navigation'),
     $searchLink = $nav.find('a.search-link'),
     $search = $('#nav-searchform .search-query');
 var nav = {
   focus: function(ev) {
     nav.toggle(true);
   },
   blur: function(ev) {
     nav.toggle(false);
   },
   toggle: function(bool) {
     $nav.toggleClass('searchform-enabled', bool).toggleClass('searchform-disabled', !bool);
   }
 };
 $searchLink.on({
   'click': function() {
     nav.focus();
     setTimeout(function(){
       $search.focus().select();
     }, 100);
   }
 });
 $search.on({
   'blur': nav.blur,
   'keypress': function(ev) {
     // Convert <esc> into a blur
     if (ev.keyCode === 27) { this.blur(); }
   }
 });

});