Authored by xuqi

search hammer

... ... @@ -4,7 +4,8 @@
* @date: 2015/10/19
*/
var $ = require('jquery');
var $ = require('jquery'),
Hammer = require('hammer');
var $input = $('#search-input input');
... ... @@ -20,13 +21,16 @@ var writeSearch = require('./write-search');
var ranToken = writeSearch.getRanToken();
$clearHistory.bind('tap', function() {
var chHammer, cHammer;
chHammer = new Hammer($clearHistory[0]);
chHammer.on('tap', function() {
localStorage.removeItem('historys');
$history.html('');
});
$input.bind('input', function() {
$input.on('input', function() {
if ($input.val() === '') {
$clear.addClass('hide');
} else {
... ... @@ -34,7 +38,8 @@ $input.bind('input', function() {
}
});
$clear.bind('tap', function() {
cHammer = new Hammer($clear[0]);
cHammer.on('tap', function() {
$input.val('').trigger('input');
});
... ...