channel.js 814 Bytes
/**
 * 频道选择页面顶部搜索
 * @author: bikai<kai.bi@yoho.cn>
 * @date: 2015/10/28
 */
var $ = require('jquery');

var $searchBox = $('.search-box'),
    $indexSearch = $('.index-search'),
    $indexLogo = $('.index-logo');

var $search = $searchBox.children('input'),
    $cancelSearch = $indexSearch.children('.no-search');

require('../common');

$search.on('focus', function() {
    $indexSearch.addClass('action');
    $indexLogo.addClass('action');
});

$cancelSearch.on('touchstart', function() {
    $indexSearch.removeClass('action');
    $indexLogo.removeClass('action');

    $search.blur();
});

$searchBox.children('.clear-text').on('touchstart', function() {
    $search.val('').focus();
});

$searchBox.children('.search-icon').on('touchstart', function() {
    $indexSearch.submit();
});