我想做一个可扩展的页脚,当你点击'+'号。 最初,我有一个很小的页脚,只有版权信息和社交媒体链接。当点击标志时,我想要一个站点地图(和其他一些东西)滑过版权信息。滑动面板向上与jquery slideToggle
但是,我需要确保页面完全向下滚动。如果不是,面板会滑动,但你不能看到它..
这是我现在有:
HTML
<div id="footer-wrapper" class="clearfix">
<footer>
<span id="footer-expander">+</span>
<section id="footer-hidden" class="clearfix">
<section id="sitemap" class="cols-3">
<h1>Sitemap</h1>
<ul>
<li><a href="">Home</a></li>
<li><a href="">About</a></li>
<li><a href="">Portfolio</a></li>
<li><a href="">Blog</a></li>
<li><a href="">Contact</a></li>
</ul>
</section>
<section class="cols-3">
<h1>Something else</h1>
</section>
<section class="cols-3">
<h1>Last, but not least.</h1>
</section>
</section>
<section id="footer-show" class="clearfix">
<p>© Helena Standaert.</p>
<section id="btm-socialmedia" class="socialmedia">
<ul>
<li class="twitter"><a href="">Twitter</a></li>
<li class="facebook"><a href="">Facebook</a></li>
<li class="linkedin"><a href="">LinkedIn</a></li>
<li class="rss"><a href="">RSS-feed</a></li>
</ul>
</section>
</section>
</footer>
</div>
JQUERY
$('#footer-expander').click(function(){
$('#footer-hidden').slideToggle('slow', function(){
goToByScroll('footer-wrapper')
if($('#footer-expander').html('-')){
$('#footer-expander').html('+');
}
if($('#footer-expander').html('+')){
$('#footer-expander').html('-');
}
});
})
谢谢!但是,我必须将document.offsetHeight更改为document.body.scrollHeight,因为页面将滚动到页面的顶部。 –
改变了解决方案:)现在其他人也可以使用它 – Martijn