I’ve just posted a question on stackoverflow about a hide/show issue I was having but that’s been resolved, though this is a follow up on that as I have come across another issue.
Ok, so I’ve got a sticky footer nav and there is a link just above the nav (also “sticky”) that says “Toggle menu” … when I click to hide the menu, the link that I’ve just clicked also hides. So basically there is no way to make the menu visible again cos the toggle button has also disappeared!
Javascript:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#stickyfooter").show();
$(".show_hide").show();
$('.show_hide').click(function(){
$("#stickyfooter").slideToggle("slow");
});
});
</script>
HTML:
<div id="stickyfooter">
<div id="stick_footer_title"><a class="show_hide" href="#">Toggle Menu ▼
</a></div>
<ul id="footer_menu">
<li class="imgmenu"><a href="#"></a></li>
<li><a href="#intro">Intro</a></li>
<li><a href="#photos">Photos</a></li>
</ul>
</div>
Now I know the stick_footer_title is within the div that gets hidden (hence why it disappears) but I’m not sure how to make it so that when I click “Toggle Menu” the link lowers with the menu that’s about to disappear but STILL shows and can be clicked again to show raise / show the nav.
I’ve tried fiddeling with the Jquery but I’m not good with jquery. I’m pretty sure that I need to do something in the Jquery, like a .show(); parameter but I’ve just been guessing to try get this right.
Any solutions?
GENERAL CSS:
#sticky_footer_title { position:absolute; top: -35px; left: 20px; background-
color:#FF0000; font-family:Arial, Helvetica, sans-serif; font-size: 18px; color:#FFF;
text-shadow:none;line-height: 34px; padding: 0px 20px 0px 20px }
#stickyfooter {
position: fixed;
bottom: 0px;
margin:0 auto;
width: 960px;
left:52%;
margin-left:-530px;
height: 40px;
background:#e9e9e9;
border-top: 1px solid #e9e9e9;
padding:0px 10px 0px 10px;
font-family:Arial, Helvetica, sans-serif;
z-index:1200;
/* CSS3 Stylings - Creates the double top border */
-moz-box-shadow: 0px -1px 0px #e9e9e9;
-webkit-box-shadow: 0px -1px 0px #e9e9e9;
box-shadow: 0px -1px 0px #e9e9e9;
/* CSS3 Rounded Corners */
-moz-border-radius: 10px 10px 0px 0px;
-webkit-border-radius: 10px 10px 0px 0px;
border-radius: 10px 10px 0px 0px;
/* CSS3 Stylings - Creates the gradient background */
background: -moz-linear-gradient(top, #FFF, #e9e9e9);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e9e9e9), to(#FFF));
}
You need to take the sticky footer toggle out the sticky footer div. The following code should work for you:
HTML:
Javascript:
CSS:
Live DEMO