當前位置:股票大全官網 - 股票行情 - 仿新浪手機版首頁那個菜單欄,點擊箭頭展開,點擊箭頭首頁,在不改變結構和樣式的情況下,求js效果

仿新浪手機版首頁那個菜單欄,點擊箭頭展開,點擊箭頭首頁,在不改變結構和樣式的情況下,求js效果

很多種做法,我寫個簡單的給妳,css和html自己去改

html:

<div?class="demo">

<a?class="open"?href="#">展開</a>

<a?class="close"?href="#">關閉</a>

</div>

css:

.demo{width:?500px;height:?100px;margin:?100px?auto;background:?#0075d5;position:?relative;}

.demo?a{color:?#fff;position:?absolute;right:?10px;bottom:?10px;}

.demo?.close{display:?none;}

jQuery:

$(".open"?).click(function(){

$(this?).hide().siblings(".close"?).show();

$(".demo"?).animate({height:'300px'},200);

return?false;

});

$(".close"?).click(function(){

$(this?).hide().siblings(".open"?).show();

$(".demo"?).animate({height:'100px'},200);

return?false;

});