質問するログイン新規登録

質問編集履歴

3

matchinの最後のanimateの末尾にdelayを付け加えました。

2019/04/15 08:09

投稿

dream
dream

スコア43

title CHANGED
File without changes
body CHANGED
@@ -68,13 +68,12 @@
68
68
  $(function (){
69
69
  $('#canon').on('click',function() {
70
70
 
71
- matchin().then
71
+ matchin(),
72
72
 
73
- (shoot);
73
+ shoot();
74
74
 
75
75
  });
76
76
  function matchin() {
77
- var d = new $.Deferred;
78
77
 
79
78
  $('#match').animate({opacity: 1},1000);
80
79
 
@@ -82,30 +81,18 @@
82
81
 
83
82
  $('.img2').animate({"bottom": "60px"},1000),
84
83
 
85
- $('#match').animate({opacity: 0},1000),function(){
84
+ $('#match').animate({opacity: 0},1000).delay(4000);
86
85
 
87
- d.resolve();
88
-
89
86
  }
90
87
 
91
- return d.promise();
92
88
 
93
- }
94
-
95
89
  function shoot() {
96
- var d = new $.Deferred;
97
90
 
98
- $('#ball').animate({opacity: 1},1000),function(){
91
+ $('.img4').animate({opacity: 1},1000);
99
92
 
100
- d.resolve();
101
-
102
93
  }
103
94
 
104
- return d.promise();
105
-
106
95
  // $('html,body').animate({scrollTop: 0},2500,"swing");
107
96
 
108
- }
109
-
110
97
  });
111
98
  ```

2

質問の一部を変更しました。

2019/04/15 08:09

投稿

dream
dream

スコア43

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,7 @@
1
1
  jquery.deferredを使って関数をつなげようとしているのですが、
2
- 調べた通りコードを書いても機能してくれません。どうすればいいか
2
+ 調べた通りコードを書いても機能してくれません。具体的には
3
+ matchinが終了したタイミングでshoot関数を実行させるといった
4
+ 感じです。どうすればいいか
3
5
  教えてください。
4
6
 
5
7
  ```HTML5

1

deferredのところがf一つ多かったので訂正しました。

2019/04/14 00:04

投稿

dream
dream

スコア43

title CHANGED
File without changes
body CHANGED
@@ -72,7 +72,7 @@
72
72
 
73
73
  });
74
74
  function matchin() {
75
- var d = new $.Defferred;
75
+ var d = new $.Deferred;
76
76
 
77
77
  $('#match').animate({opacity: 1},1000);
78
78
 
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  function shoot() {
94
- var d = new $.Defferred;
94
+ var d = new $.Deferred;
95
95
 
96
96
  $('#ball').animate({opacity: 1},1000),function(){
97
97