0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

jQueryの応用、開閉式ブロック。

Posted at

開閉式ディブ、dl=Div List, dt=Div Title, dd=DIv Descriptionによるたっぷ操作。 

// Div list 1
<dl id="panel1">
    // dt1
    <dt>Title 1</dt>
    <dd>Description of letters</dd>
    // dt2
    <dt>Title 2</dt>
    <dd>Description of letters</dd>
</dl>
<script>
// $(document(function(){ の短縮形
$(function(){
    // dd close
    $('#panel1 dd').hide();
    // A dt clicked
    $('#panel1 dt').click(function(){
        // Set d is clicked dt's children of dd
        var d = $('+dd', this);
        if(d.css('display') === 'block'){
            d.slideUp(1000);
        } else {
            d.slideDown(1000);
        }
    });
});

タグ操作だけで特定のdd を閉じたり開いたりする、ためのthisプロパティー。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?