Javascript 页脚切换,带有两个用于关闭的图像

Javascript 页脚切换,带有两个用于关闭的图像,javascript,jquery,footer,slidetoggle,Javascript,Jquery,Footer,Slidetoggle,谢谢你给了我得到帮助的机会 我想创建一个切换页脚(滑动窗格) 我发现下面的代码工作正常,但我希望能够用两个不同的按钮关闭页脚:我用来打开的同一个图像(#footer_按钮)和放置在内容中的另一个图像(十字)(#footer_内容) 我应该如何继续将此图像上的相同函数(#页脚_按钮_2)与此代码集成 非常感谢 这是一个打印屏幕: 以下是我使用的代码: <script type="text/javascript"> jQuery(function($) { var slide = fal

谢谢你给了我得到帮助的机会

我想创建一个切换页脚(滑动窗格)

我发现下面的代码工作正常,但我希望能够用两个不同的按钮关闭页脚:我用来打开的同一个图像(#footer_按钮)和放置在内容中的另一个图像(十字)(#footer_内容)

我应该如何继续将此图像上的相同函数(#页脚_按钮_2)与此代码集成

非常感谢

这是一个打印屏幕:

以下是我使用的代码:

<script type="text/javascript">
jQuery(function($) {
var slide = false;
var height = $('#footer_content').height();
$('#footer_button').click(function() {
    var docHeight = $(document).height();
    var windowHeight = $(window).height();
    var scrollPos = docHeight - windowHeight + height;
    $('#footer_content').animate({ height: "toggle"}, 1000);
    if(slide == false) {
        if($.browser.opera) { //Fix opera double scroll bug by targeting only HTML.
            $('html').animate({scrollTop: scrollPos+'px'}, 1000);
        } else {
            $('html, body').animate({scrollTop: scrollPos+'px'}, 1000);
        }
                           slide = true;
    } else {
                           slide = false;
                   }
});
});
</script>

jQuery(函数($){
var slide=false;
变量高度=$(“#页脚内容”).height();
$(“#页脚按钮”)。单击(函数(){
var docHeight=$(document).height();
var windowHeight=$(window.height();
var scrollPos=docHeight—窗高+高度;
$(“#页脚内容”)。动画({height:“toggle”},1000);
如果(幻灯片==假){
if($.browser.opera){//通过仅针对HTML修复opera双滚动错误。
$('html').animate({scrollpop:scrollPos+'px'},1000);
}否则{
$('html,body').animate({scrollTop:scrollPos+'px'},1000);
}
slide=true;
}否则{
幻灯片=假;
}
});
});

您可以使用CSS中的comas将它们分开:$(“#页脚按钮,#交叉imgid”):)


jQuery(函数($){
var slide=false;
变量高度=$(“#页脚内容”).height();
$(“#页脚按钮,#交叉imgid”)。单击(函数(){
var docHeight=$(document).height();
var windowHeight=$(window.height();
var scrollPos=docHeight—窗高+高度;
$(“#页脚内容”)。动画({height:“toggle”},1000);
如果(幻灯片==假){
if($.browser.opera){//通过仅针对HTML修复opera双滚动错误。
$('html').animate({scrollpop:scrollPos+'px'},1000);
}否则{
$('html,body').animate({scrollTop:scrollPos+'px'},1000);
}
slide=true;
}否则{
幻灯片=假;
}
});
});
<script type="text/javascript">
jQuery(function($) {
var slide = false;
var height = $('#footer_content').height();
$('#footer_button, #CrossImgID').click(function() {
    var docHeight = $(document).height();
    var windowHeight = $(window).height();
    var scrollPos = docHeight - windowHeight + height;
    $('#footer_content').animate({ height: "toggle"}, 1000);
    if(slide == false) {
        if($.browser.opera) { //Fix opera double scroll bug by targeting only HTML.
            $('html').animate({scrollTop: scrollPos+'px'}, 1000);
        } else {
            $('html, body').animate({scrollTop: scrollPos+'px'}, 1000);
        }
                           slide = true;
    } else {
                           slide = false;
                   }
});
});
</script>