[英].slideToggle up from bottom instead of down from top
So I'm trying to display a privacy policy on a single page site. 因此,我试图在单个页面上显示隐私策略。 The link is in the footer, and the privacy policy is in a display:none div above it.
链接位于页脚中,并且隐私策略位于display:none div上方。 I'm trying to make the content div slide up from the bottom of the footer, pushing all the content above it up.
我正在尝试使内容div从页脚底部向上滑动,将其上方的所有内容向上推。
HTML HTML
<section id="privContent" class="spotlight">
<div class="content">
<h2>Privacy Policy</h2>
<p>Lorem Ipsum</p>
</div>
</section>
<section class="spotlight">
<div class="content">
<a target="self" class="privClick">Privacy Policy</a>
</div>
</section>
JS JS
$(function () {
$('a[target="self"]').click(function(e) {
e.preventDefault();
$('#privContent').slideToggle('2000', "swing");
});
});
I've tried a couple of different things out, and I can't seem to get anything to work. 我已经尝试了几种不同的方法,但似乎无法解决任何问题。 I'm rather inexperienced with jQuery
我对jQuery缺乏经验
New snippet: 新片段:
$(function () { $('#privContent').hide(); $('.privClick').click(function(e) { $('#privContent').css('position', 'fixed').css('bottom', '0').slideToggle('2000', "swing").delay(2000).queue(function (next) { $(this).slideToggle('2000', "swing"); next(); });; }); });
<script src="http://code.jquery.com/jquery-1.11.3.js"></script> <section id="privContent" class="spotlight"> <div class="content"> <h2>Privacy Policy</h2> <p>Lorem Ipsum</p> </div> </section> <section class="spotlight"> <div class="content"> <a href="#" target="blank">TDI</a> | <p class="privClick">Privacy Policy</p> </div> </section>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.