私はここからこのコンパクトなニュースリーダーを手に入れました。以下は、リンクをクリックしたときのプレビューのイーズインとイーズアウトをアニメーション化するためのコードです。ページ全体のサイズを300から600に変更します。グーグルを実行し、jqueryのアニメーション部分が要素のCSSプロパティをアニメーション化します。だから私はそこから働きました。うまくいったと思っていたのですが、うまくいかなかったので、最初からやり直そうと思いました。
誰かがこれを読んで説明できますか?たとえば、私が推測しているのは、「ページ要素の上部のcssを-300pxにアニメーション化する...残りの行が理解できないことです。
助け、嫌がらせ、またはポインタをありがとう。
$current.stop().animate({'top':'-300px'},600,'easeOutBack',function(){
$(this).css({'top':'310px'});
sdfadssf
$items.each(function(i){
var $item = $(this);
$item.data('idx',i+1);
$item.bind('click',function(){
var $this = $(this);
$cn_list.find('.selected').removeClass('selected');
$this.addClass('selected');
var idx = $(this).data('idx');
var $current = $cn_preview.find('.cn_content:nth-child('+current+')');
var $next = $cn_preview.find('.cn_content:nth-child('+idx+')');
if(idx > current){
$current.stop().animate({'top':'-300px'},600,'easeOutBack',function(){
$(this).css({'top':'310px'});
});
$next.css({'top':'310px'}).stop().animate({'top':'5px'},600,'easeOutBack');
}
else if(idx < current){
$current.stop().animate({'top':'310px'},600,'easeOutBack',function(){
$(this).css({'top':'310px'});
});
$next.css({'top':'-300px'}).stop().animate({'top':'5px'},600,'easeOutBack');
}
current = idx;
});
});