关于jq左右滑动效果

一直被平均 一直被平均 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#db1").click(function(){
if($("#db2").css('width') == '200px'){
$("#db2").animate({width:0},"slow");
$("#hide").val('显示');
}else{
$("#db2").animate({width:200},"slow");
$("#hide").val('隐藏');
}
});
});
</script>
<div style=" width:800px; height:600px; background:#CCCCCC; position:relative">
<div style="width:200px; height:30px; background:#00FF00; float:right; margin-top:40px;" id="db2">111</div>
<div style=" width:150px; height:100px; background:#006699; right:200px; top:20px; cursor:pointer; position: absolute" id="db1">点击<input type="hidden" id="hide" value="隐藏" /></div>
</div>


效果没做对,绿色框应该是从右往左消失的,现在反了
而且总体感觉也不怎么对
...全文
评论 5
收藏 已收藏
分享
返回顶部
一直被平均
JavaScript 87,984 成员 224,681 内容