我正在尝试创建一个简单的 CSS 下拉菜单,该功能是正确的,但当我将其放置在固定 DIV 中时遇到问题。菜单在 DIV 内展开并添加滚动条。
我尝试隐藏溢出并定位元素,但没有效果:
body
{
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
font-size: 13px;
text-align: center;
}
.dropdown
{
text-align: left;
display: inline;
margin: 0;
padding: 0px 4px 0px 0px;
list-style: none;
}
.dropdown li
{
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
/*padding: 15px 20px;*/
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
} …Run Code Online (Sandbox Code Playgroud)我有一个jquery动画,当单击一个按钮时会移动div:
<script>
$(document).ready(function(){
$("#toggle1").click(function(){
$("#holder").animate({right: '0px'});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
如果再次单击该按钮,我希望能够将其返回到原始选项
$("#holder").animate({right: '-250px'}); // off the screen
Run Code Online (Sandbox Code Playgroud)
是否有一种简单的方法可以执行此操作,还是应该尝试基于变量状态实现if语句?
我正在使用基本的 flexslider,我想显示一些上一个和下一个,因此如果显示幻灯片 2,您将看到左侧的幻灯片 1 的一部分和右侧的幻灯片 3 的一部分。
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<style>
.container {overflow: hidden; width: 100%}
.flexslider {max-width: 500px; width: 500px; margin: 0 auto}
.content {background: #f2f2f2; max-width: 500px; display: block; margin: 0 auto}
.flex-viewport {overflow: visible !important}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div class="container">
<div class="flexslider">
<ul class="slides">
<li><img src="785.jpg" /></li>
<li><img src="785.jpg" /></li>
<li><img src="785.jpg" /></li>
<li><img src="785.jpg" /></li>
</ul>
</div>
</div>
<script src="jquery.flexslider.js"></script>
<script>
jQuery(document).ready(function($) { …Run Code Online (Sandbox Code Playgroud)