質問編集履歴

1

jQueryを追記しました。

2025/02/06 09:40

投稿

osarusam
osarusam

スコア19

test CHANGED
File without changes
test CHANGED
@@ -42,3 +42,23 @@
42
42
 
43
43
  ### 補足
44
44
  特になし
45
+
46
+ ```jQuery
47
+ <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
48
+ <script>
49
+ $(function(){
50
+ // h1要素をループ処理
51
+ $('h1').each(function() {
52
+ $('h1').fadeIn(3000);
53
+ $('h1').fadeOut(3000);
54
+ $( '#video' ).on( 'timeupdate', function ( event ) {
55
+ if ( $(this)[0].currentTime >= 20 ) {
56
+ // 20秒以上経過した際の処理
57
+ // 動画の長さは$(this)[0].duration
58
+ $('h1').fadeIn(3000);
59
+ }
60
+ });
61
+ });
62
+ });
63
+ </script>
64
+ ```