通过单击选项卡而不是单击网站的任何部分来隐藏选项卡
Hide tab by clicking the tab instead of clicking any part of the website
我在此页面上创建了一个支持选项卡(右侧的那个):http://test88.fccbet.com/
这就是我获得选项卡滑出效果的地方:http://www.building58.com/examples/tabSlideOut.html
现在,如果您单击网页的任何部分,主选项卡将隐藏。我应该添加什么js,这样它只会在我单击侧边选项卡时隐藏?
请参考此图像以了解主选项卡和侧选项卡。echosantos.com/tabslideout/tab-desired-outcome.jpg
这些是我用于此支持选项卡的代码:
.HTML:
<div id="bannerLeft">
<div class="slide-out-div no-phone no-phone-landscape" style="background-image:url(images/support-tab.png); "><br />
<a href="javascript:supportPop('https://messenger.providesupport.com/messenger/043ddykhqw98l0mslsguhu8w79.html');" id="range-logo">Fccbet</a>
<a class="handle" href="#"></a><div id="close-bottom"><img src="@routes.Assets.at("images/close-chat.jpg")"/>
</div>
.CSS:
.slide-out-div {
width: 125px;
height:392px;
background: url(../images/support-tab.png); }
#range-logo {
background-image:url(../images/support-tab.png);
display:block;
text-indent:-9999px;
width: 125px;
height:396px;}
JAVASCRIPT:
$(function () {
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will become your tab
pathToTabImage: 'http://wpaoli.building58.com/wp-content/uploads/2009/09/contact_tab.gif', //path to the image for the tab //Optionally can be set using css
imageHeight: '122px', //height of tab image //Optionally can be set using css
imageWidth: '40px', //width of tab image //Optionally can be set using css
tabLocation: 'left', //side of screen where tab lives, top, right, bottom, or left
speed: 300, //speed of animation
action: 'click', //options: 'click' or 'hover', action to trigger animation
topPos: '200px', //position from the top/ use if tabLocation is left or right
leftPos: '20px', //position from left/ use if tabLocation is bottom or top
fixedPosition: false //options: true makes it stick(fixed position) on scroll
});
$('.slide-out-div > .handle').click();
});
提前感谢!干杯!
查看jQuery.tabSlideOut
插件代码,您可以在此处看到:
https://gist.github.com/katowulf/2655810#file-jquery-tabslideout-1-3-js-L164-L165
document
正在侦听在回调中隐藏菜单的单击事件。
$(document).click(function(){
slideIn();
});
如果您不想使用此功能,我建议您从插件中删除这部分代码。
如果您认为将来可能需要此功能,可以通过向初始化插件时传入的参数添加一个属性来围绕它callerSettings
标志。
var settings = $.extend({
tabHandle: '.handle',
speed: 300,
action: 'click',
tabLocation: 'left',
topPos: '200px',
leftPos: '20px',
fixedPosition: false,
positioning: 'absolute',
pathToTabImage: null,
imageHeight: null,
imageWidth: null,
onLoadSlideOut: false,
tabHandleOffset: 0,
hideOnDocClick: true //new flag to check for doc click hide
}, callerSettings||{});
。
然后使用该标志检查是否添加侦听器:
if(settings.hideOnDocClick){
$(document).click(function(){
slideIn();
});
}
....
当您最终初始化插件时,您可以将标志设置为 false
:
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will become your tab
pathToTabImage: 'http://wpaoli.building58.com/wp-content/uploads/2009/09/contact_tab.gif', //path to the image for the tab //Optionally can be set using css
imageHeight: '122px', //height of tab image //Optionally can be set using css
imageWidth: '40px', //width of tab image //Optionally can be set using css
tabLocation: 'left', //side of screen where tab lives, top, right, bottom, or left
speed: 300, //speed of animation
action: 'click', //options: 'click' or 'hover', action to trigger animation
topPos: '200px', //position from the top/ use if tabLocation is left or right
leftPos: '20px', //position from left/ use if tabLocation is bottom or top
fixedPosition: false, //options: true makes it stick(fixed position) on scroll
hideOnDocClick: false //set flag to false - menu does NOT hide when user clicks on doc
});
相关文章:
- 单击选项卡时jquery选项卡选择不起作用
- 单击按钮进入下一个选项卡,而不是单击选项卡
- 单击选项卡时,为什么不在每次单击时切换
- 如何通过单击选项而不是实际按钮本身来选择单选按钮
- 通过单击选项卡而不是单击网站的任何部分来隐藏选项卡
- Jquery Resize问题.如果宽度小于768宽度,请启用“单击选项”.768以上鼠标悬停选项启用
- Angular Bootstrap选项卡在单击选项卡后更改url
- 单击选项卡时要关闭的幻灯片菜单
- 单击选项卡时,页面会在活动后向下跳转
- 当有人单击选项卡“x”时退出反馈弹出窗口
- 模拟单击选项并等待更改事件完成
- 自动单击选项卡 Jquery 带按钮
- 触发模态事件时单击选项卡
- 在单击选项卡式项目时隐藏和创建另一个对象 - HTML CSS
- 通过 JavaScript 链接 href 以单击选项卡中的按钮
- 单击选项卡时在 HTML 中向下跳转
- jQuery 单击选项卡以打开和关闭
- Jquery - 检测禁用的 HTML 选择的单击选项
- 在多个下拉列表中单击选项
- 单击选项卡时如何提交表单