1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /*
- @update:2018/06/04
- */
- import 'css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css'
- import 'css/newMenu/demand.css';
- import 'js/public.js';
- import 'js/newMenu/demand.js';
- $(function () {
- init();
- function init() {
- nav();
- industryFun();
- search();
- searchFun();
- inpFun();
- }
- //二级导航
- function nav() {
- $('.nav ul li').mouseenter(function () {
- $(this).find('.subnavigation').slideDown(100);
- });
- $('.nav ul li').mouseleave(function () {
- $(this).find('.subnavigation').slideUp(100);
- $('.nav ul li').stop(false, true);
- });
- //轮播
- $('#myCarousel').carousel({
- interval: 4000
- })
- }
- //行业选择
- function industryFun() {
- $('.navMeau').mouseenter(function () {
- $(this).find('.menuList').slideDown(200);
- });
- $('.navMeau').mouseleave(function () {
- $(this).find('.menuList').slideUp(200);
- $('.navMeau').stop(false, true);
- });
- }
- //搜索
- let valArr = [],valTxt=[];
- function search(){
- $('.menuList ul li').on('click',function(){
- let txts = $(this).text();
- valArr=[];
- valTxt=[];
- inputVal(txts);
- })
- }
- function inputVal(item){
- $('.demandSearch').val('');
- valTxt.push(item);
- valArr.push(`<span>${item}</span>`);
- $('.demandSearch').attr('placeholder','');
- $('.txtVal').html(valArr);
- }
- function inpFun(){
- $('.demandSearch').focus(function(){
- if(valArr.length){
- valArr=[];
- valTxt=[];
- $('.txtVal').html('');
- }
- })
- $('.demandSearch').focus(function(){
- if(!valArr.length&&!($(this).val())){
- $('.demandSearch').attr('placeholder','输入你感兴趣的内容');
- }
- })
- }
- function searchFun(){
- $('.searchBtn').on('click',function(){
- let sVal = $('.search-inp .demandSearch').val();
- if(sVal){
- console.log(sVal);
- // window.location.href = globalConfig.context + '/user/account/index.html#consultList'
- }
- if(valTxt.length){
- console.log(valTxt.join(''))
- }
- });
-
- }
- })
|