アクセスと同時に強制的に一番下までスクロールさせる

Ads

Result

再生ボタンで動作を確認できます。

jQuery

    function footerStart(selector){
          // #itemまでスクロール
        $('html,body').animate({scrollTop: $(selector).offset().top},'slow');
        //スクロールの着地点を生成
    }$("#parent").append("<li id='item'>Last!!</li>");
     //セレクタ指定
    footerStart("#item");

html

<ul id='parent'>
  <li>start!!</li>
  <li><br/>1<br/>2<br/>3<br/>4<br/>・・・<br/>119</li>
</ul>

via

Scroll a list item such that it becomes visible? – Stack Overflow

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