ワードプレスで、カテゴリ別の一覧を作っています。
flexboxを使い、親パネルと子パネルを作成しました。
親パネルに justify-content: center;で横幅可変です。メディアクエリを使用しました。
そうすると、一番下の行が、カラム数により縦に揃いません。なのでその時に横並びに足りない分の空の子パネルを挿入したいです。
・CSS
/* 親パネル */
.p_list {
display: flex;
flex-flow: row wrap;
justify-content: center;
}
/** 空の子パネル **/
.clist.is-empty {
height: 0;
padding-top: 0;
padding-bottom: 0;
margin-top: 0;
margin-bottom: 0;
}
@media only screen and (max-width: 2500px) {
.clist{
width : 16%;
margin : 1%;
}
}
@media only screen and (max-width: 1600px) {
.clist {
width : 19%;
margin : 1%;
}
}
・
・
・
・JS
jQuery(function($){
var $ml_cnt = $('.p_list'),
emptyCells = [],
i;
for (i = 0; i < $ml_cnt.find('.clist').length; i++) { emptyCells.push($("<div class = 'clist'><div class = 'clist.is-empty'></div></div>")); } $ml_cnt.append(emptyCells); }
);
発生している問題・エラーメッセージ
Uncaught TypeError: $ is not a function
at HTMLDocument.<anonymous> (merchantslist.js:15)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)
(anonymous) @ merchantslist.js:15
i @ jquery.js?ver=1.12.4:2
fireWith @ jquery.js?ver=1.12.4:2
ready @ jquery.js?ver=1.12.4:2
K @ jquery.js?ver=1.12.4:2
20年以上前に少しパソコンを触っていた程度で、このような高度なことをやっていいのかわからないのですが、エラーをどう解決すれば良いものかわからず。。
一日、インターネットとにらめっこをしてみたのですが、解決に至りませんでした。
足りない情報などありましたらすみません。
どなたかお力を貸していただけましたら幸いです
回答1件
あなたの回答
tips
プレビュー