LoginSignup
20
20

More than 5 years have passed since last update.

画面に要素が見えたら処理をする

Posted at

スクロールして、画面に指定の要素が見えたら特定の処理を実行するスクリプトです。

script
$(window).on('scroll' , function(){
  if ($("要素名").is(":hidden")) {
    //見えてなかったら
  } else {
    //見えてたら
  }
});
20
20
1

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
20
20