2012-02-15 9 views
0

jqueryを使用しているイベントに対してmouseoutのスクロールバー&を表示しています。今度は、そのタスクにfadeOutとfadeInトランジションを適用したいと思います。スクロールは適切にfadeOutですが、コンテンツを持つdivタグ全体がfadeOutの後に隠されています。私のタスクを達成する方法を教えてください....(私のコードが正しいとはわかりません)。ここでFadeOut Scrollbar on MouseOverイベント

は、あなたのコードからこれらの行は

<!DOCTYPE HTML> 
<html> 
<head> 
    <title> New Document </title> 
    <meta name="Generator" content="EditPlus"> 
    <meta name="Author" content=""> 
    <meta name="Keywords" content=""> 
    <meta name="Description" content=""> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
    <script> 
    $(document).ready(function(){ 
    $('div').mouseover(function(){ 
     $(this).css({"overflow":"auto"}).fadeIn(); 
     }); 
    $('div').mouseout(function(){ 
     $(this).css({"overflow":"hidden"}).fadeOut(); 
     }); 

    }); 
    </script> 
    <style> 
    div{ 
    width:200px; 
    height:200px; 
    overflow:hidden; 
    border:2px solid red; 
    } 
    </style> 
</head> 

<body> 
    <div> 
    This is the recommended version of jQuery to use for your application. The code in here should be stable and usable in all modern browsers. 

The minified versions, while having a larger file size than the packed versions (note: packed version is not available in current release), are generally the best versions to use on production deployments. The packed versions require non-trivial client-side processing time to uncompress (unpack) the code whereas the minified versions do not. The packed versions of jQuery will take less time to download than the minified or uncompressed versions; however, each time the library is loaded (initially or from the browser cache) it will need to be uncompressed which will cause a non-trivial delay in the execution of any jQuery code each time it is loaded. 
    </div> 

</body> 
</html> 

答えて

1
$(this).css({"overflow":"auto"}) 
$(this).css({"overflow":"hidden"}) 

...私のコードであるスクロールバーが表示されたり消えたりします。
Jadeコールがカスケード接続されているので、fadeOutの呼び出しによってdivがfadeOutになります。
スクロールバーをフェードアウトする場合は、カスタムスクロールバーを実装する必要があります(facebookなど)

1

これはできません。

フェーディングは、要素の不透明度を徐々に調整することによって機能します。スクロールバーは要素そのものではないため、ターゲットにすることや不透明度を調整することはできません。それはオン(オーバーフロー:自動)またはオフ(オーバーフロー:なし)のいずれかです。

実際のスクロールバーを完全に無効にし、jScrollPaneプラグインを使用してそれを置き換えることができます。

次に、jScrollPaneによって作成されたdiv.jspVerticalBarにfadeIn()および​​関数を使用できます。

http://jscrollpane.kelvinluck.com/

関連する問題