質問編集履歴

2

呼び出し箇所の追加

2018/09/11 07:14

投稿

nohohon
nohohon

スコア11

test CHANGED
File without changes
test CHANGED
@@ -132,6 +132,26 @@
132
132
 
133
133
 
134
134
 
135
+ (補足:関数の呼び出し/(index))
136
+
137
+ 呼び出しているのはここでしょうか…
138
+
139
+ この一文がうまく機能していないようです。
140
+
141
+ エラーメッセージにあった
142
+
143
+ at HTMLDocument.<anonymous> ((index):330)
144
+
145
+ の(index)の箇所をクリックすると、以下の一文がマークされたソースコードが出てきます。
146
+
147
+ ```
148
+
149
+ init_post_list('.p-blog-list__item', 1, 'これ以上記事はございません', 'http://略');
150
+
151
+ ```
152
+
153
+
154
+
135
155
  ### 試したこと
136
156
 
137
157
 

1

関数定義箇所の追加

2018/09/11 07:14

投稿

nohohon
nohohon

スコア11

test CHANGED
File without changes
test CHANGED
@@ -38,6 +38,98 @@
38
38
 
39
39
 
40
40
 
41
+ (補足:関数の定義箇所/infinitescroll.js)
42
+
43
+ ```
44
+
45
+ function init_post_list(target, maxPage, finishedMsg, imgPath) {
46
+
47
+ var $container = jQuery('#js-infinitescroll');
48
+
49
+ $container.imagesLoaded(function(){
50
+
51
+ jQuery(target, '#js-infinitescroll').each(function(i){
52
+
53
+ jQuery(this).delay(i*150).queue(function(){
54
+
55
+ jQuery(this).addClass('is-active').dequeue();
56
+
57
+ });
58
+
59
+ });
60
+
61
+ $container.infinitescroll({
62
+
63
+ navSelector : '#js-load-post',
64
+
65
+ nextSelector : '#js-load-post a',
66
+
67
+ itemSelector : target,
68
+
69
+ animate : true,
70
+
71
+ extraScrollPx: 150,
72
+
73
+ maxPage: maxPage,
74
+
75
+ loading: {
76
+
77
+ msgText : 'LOADING...',
78
+
79
+ finishedMsg : finishedMsg,
80
+
81
+ img: imgPath
82
+
83
+ }
84
+
85
+ },
86
+
87
+ // callback
88
+
89
+ function(newElements, opts) {
90
+
91
+ var $newElems = jQuery(newElements);
92
+
93
+ $newElems.imagesLoaded(function(){
94
+
95
+ $newElems.each(function(i){
96
+
97
+ jQuery(this).delay(i*150).queue(function(){
98
+
99
+ jQuery(this).fadeTo('slow', 1).dequeue();
100
+
101
+ });
102
+
103
+ });
104
+
105
+ });
106
+
107
+ if (opts.maxPage && opts.maxPage <= opts.state.currPage) {
108
+
109
+ jQuery(window).off('.infscr');
110
+
111
+ jQuery('#js-load-post').remove();
112
+
113
+ }
114
+
115
+ });
116
+
117
+ });
118
+
119
+ }
120
+
121
+
122
+
123
+ ```
124
+
125
+ (補足:関数の定義箇所/infinitescroll.min.js)
126
+
127
+ ```
128
+
129
+ function init_post_list(e,i,t,a){var n=jQuery("#js-infinitescroll");n.imagesLoaded(function(){jQuery(e,"#js-infinitescroll").each(function(e){jQuery(this).delay(150*e).queue(function(){jQuery(this).addClass("is-active").dequeue()})}),n.infinitescroll({navSelector:"#js-load-post",nextSelector:"#js-load-post a",itemSelector:e,animate:!0,extraScrollPx:150,maxPage:i,loading:{msgText:"LOADING...",finishedMsg:t,img:a}},function(e,i){var t=jQuery(e);t.imagesLoaded(function(){t.each(function(e){jQuery(this).delay(150*e).queue(function(){jQuery(this).fadeTo("slow",1).dequeue()})})}),i.maxPage&&i.maxPage<=i.state.currPage&&(jQuery(window).off(".infscr"),jQuery("#js-load-post").remove())})})}
130
+
131
+ ```
132
+
41
133
 
42
134
 
43
135
  ### 試したこと