如何将按钮文字在点击后由显示改为隐藏,并在向上滑动后保持显示?

How to change the button text from show to hide after click, and also keep it showen after slide up?

我正在尝试做一些类似于您在本网站末尾看到的地图的事情, http://www.insegment.com/

这是html

    <div class="clear">
    <button id=slideToggle>Show full map</button>
<div class="slideTogglebox">            
</div> </div>

脚本:

$("#slideToggle").click(function () {   $('.slideTogglebox').slideToggle(500); });

提前致谢

做...

$("#slideToggle").click(function () {   

$(this).html(($(this).html()=="Show full map"?"Hide map":"Show full map"));

// To move up
$(this).toggleClass("moveUp");

$('.slideTogglebox').slideToggle(500); 

});

并把 css 上移到 moveUp

这里是jsFiddle,

此外....您还缺少 </div>