如何使用jquery在旋转木马上隐藏和显示页脚
How hide and show footer above carousel with jquery?
我希望在加载主页时隐藏页脚,并在单击show
和hide
按钮时显示和隐藏页脚我的按钮代码可以很好地显示和隐藏页脚我的问题是:页面加载时如何隐藏页脚,以及如何在转盘上方插入页脚?谢谢
$(document).ready(function () {
$("#hide").hover(function () {
$("footer").hide(1000);
});
$("#show").hover(function () {
$("footer").show(1000);
});
});
<div style="margin-left: auto; margin-right: auto;">
<div style="padding: 0;">
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="3000">
<div class="carousel-inner">
@foreach (var item in Model.Carousels)
{
if (item == Model.Carousels.FirstOrDefault())
{
<div class="item active ">
<img style="height:380px; width:100%;" class="img-responsive center-block" src="@Url.Content(item.CarouselImage.ToString())">
<div class="carousel-caption">
<h2 class="h">@item.CarouselSubject</h2>
<h4 class="h">@item.CarouselInfo</h4>
</div>
</div>
}
else
{
<div class="item">
<img style="height: 380px; width: 100%;" class="img-responsive center-block" src="@Url.Content(item.CarouselImage.ToString())" />
<div class="carousel-caption">
<h2 class="h">@item.CarouselSubject</h2>
<h4 class="h">@item.CarouselInfo</h4>
</div>
</div>
}
}
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="text-center">
<button id="hide">Hide</button>
<button id="show">Show</button>
</div>
<footer class="footer" style="background-color:#191919; text-align:center;color:GrayText;clear:both;margin-bottom:-30px;">
<div>
<ul style="display: inline-block; text-align: right; list-style-type: none;" class="list-group">
<li style="font-weight:bold;" class="list-group-item">quick</li>
<li class="list-group-item"><a class="Alist" href="">login</a></li>
<li class="list-group-item"><a class="Alist" href="">sign up</a></li>
</ul>
<ul style="display:inline-block;text-align:right;list-style-type:none;" class="list-group">
<li style="font-weight:bold;" class="list-group-item">manu</li>
<li class="list-group-item"><a class="Alist" href="">text5</a></li>
<li class="list-group-item"><a class="Alist" href="">text6</a></li>
<li class="list-group-item"><a class="Alist" href="">text7</a></li>
</ul>
<ul style=" display:inline-block;text-align:right;list-style-type:none;" class="list-group">
<li style="font-weight:bold; padding-bottom:10px;" class="list-group-item">follow us</li>
<li class="list-group-item">
@foreach (var item in Model.SocialNetworks)
{
<ul style=" display:inline-block;text-align:right;list-style-type:none;">
<li>
<a href="@item.SocialLink">
<img class="img-responsive center-block socialIcon" src="@Url.Content(item.SocialIcon.ToString())" />
</a>
</li>
</ul>
}
</li>
</ul>
</div>
<div>
<hr style="width: 70%; background-color: #5d5d5d; height: 0.5px; border: 0 none; " />
</div>
<div style="text-align:center;">
<span style="text-align:center;">©</span>
</div>
</footer>
</div>
如前一个答案所述,请使用此选项隐藏页脚:
$(document).ready(function(){
$("footer").hide();
});
要插入关于转盘的footer
,可以使用:
$("footer").insertBefore(".carousel");
这是为了在页面加载时隐藏页脚:
$(document).ready(function(){
$("footer").hide();
});
对于转盘上方的插入页脚:
$("footer").insertBefore("#myCarousel");
相关文章:
- 在jquery中为显示/隐藏设置cookie
- PHP Javascript显示/隐藏按钮不工作
- 打开/关闭按钮以显示/隐藏内容
- 显示隐藏复选框
- 在bootstrap中显示隐藏特定的li
- JQuery上下文菜单显示/隐藏问题
- JQuery在单击时停止显示/隐藏
- HTML5在提交并显示所需标签后显示隐藏的表单元素
- 使用 jQuery 切换显示/隐藏
- 显示/隐藏有关模型更改的指令内容
- Bootstrap在页面加载缓慢时会立即显示隐藏的模式对话框
- 根据特定条件使用ng显示/ng隐藏来显示/隐藏元素
- 显示/隐藏不起作用
- 使用ng-hide根据条件显示/隐藏按钮
- 仅在第一个结果中显示/隐藏MySQL结果函数
- 显示/隐藏http://ftp链接
- 在显示/隐藏中单击时删除的文本
- 是否可以在不重新渲染的情况下显示/隐藏父对象中的元素
- 将页面内容向左移动时显示/隐藏右侧面板
- 显示/隐藏将不会加载