時間が経つと非表示になるボックスを作る

Ads

Result

jQuery

$(document).ready(function() {
         //queue()で処理を溜めてdequeue()で実行。3秒経ったらfadeOut()
        $("#timeout").fadeIn().queue(function() {
            setTimeout(function(){$("#timeout").dequeue();
            }, 3000);
        });
        $("#timeout").fadeOut();
});

css

#timeout{
    position:absolute;
    top:30px;
    left:50px;
    padding:20px; 
    border:1px solid #ddd;
    background:#eee;
}

html

<div id="timeout">
  <p>Time out</p>
</div>

Warning: include(/home/youhei0828/kachibito.net/public_html/wp-content/themes/cocoon-master/my-php/jquery-other-snippets.php): Failed to open stream: No such file or directory in /home/youhei0828/kachibito.net/public_html/wp-content/themes/kachibito7_with_cocoon_child/functions-module/shortcode/add-post-myphp.php on line 7

Warning: include(): Failed opening '/home/youhei0828/kachibito.net/public_html/wp-content/themes/cocoon-master/my-php/jquery-other-snippets.php' for inclusion (include_path='.:/opt/php-8.1.29/data/pear') in /home/youhei0828/kachibito.net/public_html/wp-content/themes/kachibito7_with_cocoon_child/functions-module/shortcode/add-post-myphp.php on line 7