个人Google搜索栏阻止jQuery下面 [英] Personal Google search bar blocking jQuery underneath

查看:113
本文介绍了个人Google搜索栏阻止jQuery下面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在我的网站上添加了Google搜索栏。我发现即使搜索没有活动,它也阻止了下面的导航。如果我把导航z-index向上,然后显示在搜索结果。如何使搜索栏不滚动,使按钮是可点击。在此处查看页面 http://etterengineering.com/SampleIndex.html

I recently added a Google search bar to my website. How I found that it is blocking the navigation underneath even when the search is not active. If I bring the navigation z-index up it is then displayed over the search results. How do I make it so the buttons are "clickable" when the search bar is not rolled down. View page here http://etterengineering.com/SampleIndex.html

这是我的HTML:

<div id="cse-search-form" style= "z-index:999999; top:0px;"></div>
<div id="cse-search-form" style="width: 100%;"></div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
  google.load('search', '1', {language : 'en', style : google.loader.themes.SHINY});
  google.setOnLoadCallback(function() {
    var customSearchControl = new google.search.CustomSearchControl('012677673255316824096:sean13fvlei');
    customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
    var options = new google.search.DrawOptions();
    options.setSearchFormRoot('cse-search-form');
    customSearchControl.draw('cse', options);
  }, true);
</script>
<div id="cse" style="width:43%; z-index:999997; top:40px; height:650px;"></div>

和我的CSS

#cse-search-form {
    position:absolute; 
    z-index:999999; 
    width:270px; 
    left:680px;}
#cse{position:absolute; z-index:999997; left: 530px; 
overflow:auto;overflow-x:hidden; pointer-events:none;
    }
 #dropdown {      
  margin: 0;
  padding: 0;
  height: 1em;
  }
 #dropdown li {
  float: left;    
  list-style: none;
  }
 #dropdown li a {
  display: block;
  width:12em;     
  padding: 3px 0px;   
  background-color: transparent;      
  white-space:pre;    
  font-size:.8em;
  letter-spacing: -.4px;        
  text-align:center; 
  z-index: 24000;     
  font-family: Verdana;   
  color: #424242;
  position: relative; top:105px; left: 0px;   
  text-decoration: none; 
  }
  #dropdown li a:hover {color:#000000;}
  /* Sub Drop Down Organization */
  #dropdown li ul {
  display: none; 
  width: 18em;    
      letter-spacing:  1em;
  text-align:center;
  }
  /* Sub Drop down Hover */
  #dropdown li:hover ul {
  display: block;
  position: absolute;
  margin: 0;
  padding: 0; }
 #dropdown li:hover li a {
  word-spacing: .025em;       
  letter-spacing: -.05em;     
  font-size:.8em; 
  font-family: Verdana;   
  background: #6e6e6e; background: -webkit-gradient(linear, left top, left bottom, from(#FFFFFF), to(#ADADAD));
      background: -moz-linear-gradient(top,  #FFFFFF,  #ADADAD);
  }
  #dropdown li li a:hover {color:#ff0000;}


推荐答案

您的问题不是Google搜索栏,您有一个id为cse的div,阻止点击链接。

Your problem is not the Google search bar, you have a div with an id of "cse" that is preventing clicking of links.

问题的图片:

Picture of issue:

CSS:

#cse {display:none;}

在搜索框中分配一个ID,例如 googleSearch

Assign an Id to the search box such as googleSearch.

jQuery:

$(function() {
    $("#googleSearch").focus(function() {
        $("#cse").show();
    });
    $("#googleSearch").blur(function() {
        $("#cse").hide();
    });
});

这篇关于个人Google搜索栏阻止jQuery下面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆