使用jquery滑出div
最近,我找到了一个解决方案,可以在单击时滑出div 他们发布了链接使用jquery滑出div,jquery,Jquery,最近,我找到了一个解决方案,可以在单击时滑出div 他们发布了链接jsfiddle.net/LU8En/ 在JSFIDLE回答中,他们使用了jQuery1.7.2。它不适用于jquery1.9.1。我不知道原因。。?有什么想法吗?试试这个: .toggle(函数,函数,…)已从版本1.9中删除 见 更好的方法: 试试这个: .toggle(函数,函数,…)已从版本1.9中删除 见 更好的方法: 切换功能已从1.9 jquery中删除 您可以尝试以下方法: 切换功能已从1.9 jquery中删除
jsfiddle.net/LU8En/
在JSFIDLE回答中,他们使用了jQuery1.7.2。它不适用于jquery1.9.1。我不知道原因。。?有什么想法吗?试试这个:
.toggle(函数,函数,…)已从版本1.9中删除
见
更好的方法:
试试这个:
.toggle(函数,函数,…)已从版本1.9中删除
见
更好的方法:
切换功能已从1.9 jquery中删除 您可以尝试以下方法:
切换功能已从1.9 jquery中删除 您可以尝试以下方法:
下面的示例可以帮助您。谢谢 从左侧滑出
是的,有龙,先生!
#滑出{
背景:#666;
位置:绝对位置;
宽度:300px;
高度:80px;
最高:45%;
左:-280px;
}
#点击我{
浮动:对;
高度:20px;
宽度:20px;
背景:#ff0000;
}
#滑动内容{
浮动:左;
}
$(函数(){
$(“#单击我”)。切换(函数(){
$(this.parent().animate({left:'0px'},{queue:false,duration:500});
},函数(){
$(this.parent().animate({left:'-280px'},{queue:false,duration:500});
});
});
从右边滑出
是的,有龙,先生!
身体{
溢出x:隐藏;
}
#滑出{
背景:#666;
位置:绝对位置;
宽度:280px;
高度:80px;
最高:45%;
右:-280px;
左侧填充:20px
}
#点击我{
位置:绝对位置;
顶部:0;左侧:0;
高度:20px;
宽度:20px;
背景:#ff0000;
}
#滑动内容{
浮动:左;
}
$(函数(){
$(“#单击我”)。切换(函数(){
$(this.parent().animate({right:'0px'},{queue:false,duration:500});
},函数(){
$(this.parent().animate({right:'-280px'},{queue:false,duration:500});
});
});
下面的示例可以帮助您。谢谢
从左侧滑出
是的,有龙,先生!
#滑出{
背景:#666;
位置:绝对位置;
宽度:300px;
高度:80px;
最高:45%;
左:-280px;
}
#点击我{
浮动:对;
高度:20px;
宽度:20px;
背景:#ff0000;
}
#滑动内容{
浮动:左;
}
$(函数(){
$(“#单击我”)。切换(函数(){
$(this.parent().animate({left:'0px'},{queue:false,duration:500});
},函数(){
$(this.parent().animate({left:'-280px'},{queue:false,duration:500});
});
});
从右边滑出
是的,有龙,先生!
身体{
溢出x:隐藏;
}
#滑出{
背景:#666;
位置:绝对位置;
宽度:280px;
高度:80px;
最高:45%;
右:-280px;
左侧填充:20px
}
#点击我{
位置:绝对位置;
顶部:0;左侧:0;
高度:20px;
宽度:20px;
背景:#ff0000;
}
#滑动内容{
浮动:左;
}
$(函数(){
$(“#单击我”)。切换(函数(){
$(this.parent().animate({right:'0px'},{queue:false,duration:500});
},函数(){
$(this.parent().animate({right:'-280px'},{queue:false,duration:500});
});
});
试试这个脚本,它有助于创建滑出div以实现简单的方式
<script>
$(function(){
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will be your tab
pathToTabImage: 'images/contact_tab.gif', //path to the image for the tab *required*
imageHeight: '122px', //height of tab image *required*
imageWidth: '40px', //width of tab image *required*
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
fixedPosition: true, //options: true makes it stick(fixed position) on scroll
onLoadSlideOut: true
});
});
</script>
<div class="slide-out-div">
<a class="handle" href=""></a>
<h3>San Web Corner</h3>
<p>San Web Corner is one of the simple tutorial blog consist various tips and codes</p>
</div>
$(函数(){
$('.slide out div').tab滑出({
tabHandle:'.handle',//将作为选项卡的元素的类
pathToTabImage:'images/contact_tab.gif',//选项卡的图像路径*必需*
imageHeight:'122px',//选项卡图像的高度*必需*
imageWidth:'40px',//选项卡图像的宽度*必需*
tabLocation:'左',//选项卡所在屏幕的一侧,顶部、右侧、底部或左侧
速度:300,//动画速度
操作:'单击',//选项:'单击'或'悬停',触发动画的操作
topPos:'200px',//从顶部开始的位置
fixedPosition:true,//选项:true使其在滚动上保持(固定位置)
onLoadSlideOut:真
});
});
San网络角
SanWebCorner是一个简单的教程博客,包含各种提示和代码
试试这个脚本,它有助于创建滑出div以实现简单的方式
<script>
$(function(){
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will be your tab
pathToTabImage: 'images/contact_tab.gif', //path to the image for the tab *required*
imageHeight: '122px', //height of tab image *required*
imageWidth: '40px', //width of tab image *required*
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
fixedPosition: true, //options: true makes it stick(fixed position) on scroll
onLoadSlideOut: true
});
});
</script>
<div class="slide-out-div">
<a class="handle" href=""></a>
<h3>San Web Corner</h3>
<p>San Web Corner is one of the simple tutorial blog consist various tips and codes</p>
</div>
$(函数(){
$('.slide out div').tab滑出({
tabHandle:'.handle',//将作为选项卡的元素的类
pathToTabImage:'images/contact_tab.gif',//选项卡的图像路径*必需*
imageHeight:'122px',//选项卡图像的高度*必需*
imageWidth:'40px',//选项卡图像的宽度*必需*
tabLocation:'左',//选项卡所在屏幕的一侧,顶部、右侧、底部或左侧
速度:300,//动画速度
操作:'单击',//选项:'单击'或'悬停',触发动画的操作
topPos:'200px',//从顶部开始的位置
fixedPosition:true,//选项:true使其在滚动上保持(固定位置)
onLoadSlideOut:真
});
});
San网络角
San Web
var test= true;
$("#clickme").click(function () {
if(test){
$(this).parent().parent().animate({left:'0px'}, {queue: false, duration: 500});
}
else{
$(this).parent().parent().animate({left:'-280px'}, {queue: false, duration: 500});
}
test= !test;
<div id="slideout">
<div id="slidecontent">
Yar, there be dragonns herre!
</div>
<div id="clickme">
</div>
</div>
#slideout {
background: #666;
position: absolute;
width: 300px;
height: 80px;
top: 45%;
left:-280px;
}
#clickme {
float: right;
height: 20px;
width: 20px;
background: #ff0000;
}
#slidecontent {
float:left;
}
$(function () {
$("#clickme").toggle(function () {
$(this).parent().animate({left:'0px'}, {queue: false, duration: 500});
}, function () {
$(this).parent().animate({left:'-280px'}, {queue: false, duration: 500});
});
});
<div id="slideout">
<div id="slidecontent">
Yar, there be dragonns herre!
</div>
<div id="clickme">
</div>
</div>
body {
overflow-x: hidden;
}
#slideout {
background: #666;
position: absolute;
width: 280px;
height: 80px;
top: 45%;
right:-280px;
padding-left: 20px
}
#clickme {
position: absolute;
top: 0; left: 0;
height: 20px;
width: 20px;
background: #ff0000;
}
#slidecontent {
float:left;
}
$(function () {
$("#clickme").toggle(function () {
$(this).parent().animate({right:'0px'}, {queue: false, duration: 500});
}, function () {
$(this).parent().animate({right:'-280px'}, {queue: false, duration: 500});
});
});
<script>
$(function(){
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will be your tab
pathToTabImage: 'images/contact_tab.gif', //path to the image for the tab *required*
imageHeight: '122px', //height of tab image *required*
imageWidth: '40px', //width of tab image *required*
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
fixedPosition: true, //options: true makes it stick(fixed position) on scroll
onLoadSlideOut: true
});
});
</script>
<div class="slide-out-div">
<a class="handle" href=""></a>
<h3>San Web Corner</h3>
<p>San Web Corner is one of the simple tutorial blog consist various tips and codes</p>
</div>