Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide a fixed footer?

Hi I was wondering is there a way to hide a fixed footer with a button, so it can be closed by the user if they want to see more of the screen and vise versa. Is there a way to do this with css or will it require javascript?

cheers.

like image 339
GibsonFX Avatar asked Sep 20 '25 00:09

GibsonFX


1 Answers

JavaScript

<input type="button" id="myButton" onclick="HideFooter()" />

function HideFooter()
{
    var display = document.getElementById("myFooter").style.display;
    if(display=="none")
        document.getElementById("myFooter").style.display="block";
    else
        document.getElementById("myFooter").style.display="none";
}

JQuery

$("#myButton").click(function(){

    if($("#myFooter").is(":visible"))
        $("#myFooter").hide();
    else
        $("#myFooter").show();
});

If you want some other nice effects

$("#myFooter").fadeOut(500);
$("#myFooter").slideUp(500);
$("#myFooter").slideToggle(500); //Hide and Show

Another method, as Bram Vanroy Suggested:

$("#myButton").click(function(){

    $("#myFooter").toggle();
});
like image 81
Ali Bassam Avatar answered Sep 21 '25 12:09

Ali Bassam