瀏覽代碼

On blur exit search if input vaalue is empty

Yuin Chien 6 年之前
父節點
當前提交
673d4c9b03
共有 2 個文件被更改,包括 16 次插入0 次删除
  1. 8 0
      docs/index.html
  2. 8 0
      examples/index.html

+ 8 - 0
docs/index.html

@@ -128,6 +128,14 @@
 
 			}
 
+			filterInput.onblur = function ( event ) {
+
+				if(filterInput.value === '') {
+					panel.classList.remove('searchFocused');
+				}
+
+			}
+
 			exitSearchButton.onclick = function( event ) {
 
 				filterInput.value = '';

+ 8 - 0
examples/index.html

@@ -202,6 +202,14 @@
 
 		}
 
+		filterInput.onblur = function ( event ) {
+
+			if(filterInput.value === '') {
+				panel.classList.remove('searchFocused');
+			}
+
+		}
+
 		exitSearchButton.onclick = function( event ) {
 
 			filterInput.value = '';