赤いSpoilers!というテープの上にマウスオーバーすると、隠されているコンテンツが表示されます。
このテキストからマウスアウトすると、また隠されますw
上記の例に、the hoverIntent plugin(ホバー処理)を使用して、隠された部分を表示されるのが早すぎないようにしています。
このテキストからマウスアウトすると、また隠されますw
このテキストは、再度クリックするとまた隠されますw
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>jQuery Spoilers plugin | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <!-- JS --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.hoverIntent.js"></script> <script type="text/javascript" src="/content/lib/jquery/sgbeal-spoilers.jquery.js"></script> <script type="text/javascript"> $(function(){ // On-hover spoiler: $('.jqSpoiler').initSpoilers(); // On-hover spoiler using hoverIntent plugin: $('.jqSpoilerIntent').initSpoilers({method:'hoverIntent'}).addClass('jqSpoiler'); // Clickable spoiler: $('.jqSpoilerClick').initSpoilers({method:'click'}).addClass('jqSpoiler'); }); </script> <!-- CSS --> <style type="text/css"> .jqSpoiler { background:transparent url(/content/img/ajax/bg_spoilers.png) repeat 0 0; border:1px dotted red; font-weight:bold; color:red; line-height:2; } .jqSpoiler span { visibility:hidden; } .jqSpoiler.reveal { background-image:none; border:none; } .jqSpoiler.reveal span { visibility:visible; } </style> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <div id="wrap"> <h1><a href='http://wanderinghorse.net/computing/javascript/jquery/spoilers/demo.html'>jQuery Spoilers plugin</a> | 設置サンプル</h1> <!-- CODE --> <h2>マウスオーバーで隠されている部分を表示、マウスアウトで非表示に</h2> <p> 赤いSpoilers!というテープの上にマウスオーバーすると、隠されているコンテンツが表示されます。<br> <span class='jqSpoiler'><span>このテキストからマウスアウトすると、また隠されますw</span></span> </p> <h2>マウスオーバーで隠されている部分を表示、マウスアウトで非表示に(the hoverIntent plugin使用)</h2> <p> 上記の例に、<a href='http://cherne.net/brian/resources/jquery.hoverIntent.html'>the hoverIntent plugin</a>(ホバー処理)を使用して、隠された部分を表示されるのが早すぎないようにしています。<br> <span class='jqSpoilerIntent'><span>このテキストからマウスアウトすると、また隠されますw</span></span> </p> <h2>クリックで隠されている部分の表示・非表示を交互に切り替え</h2> <p> <span class='jqSpoilerClick'><span>このテキストは、再度クリックするとまた隠されますw</span></span> </p> <!-- / CODE --> </div> </body> </html>