我决定在我的网站上使用这个日历插件
但它不起作用。 我收到此错误
$(...)。pignoseCalendar不是一个函数 在HTMLDocument。 (索引:97) at mightThrow(jquery-3.1.1.js:3570) 在过程中(jquery-3.1.1.js:3638)
但我包含了jquery插件。
这是我的代码
<script src="~/Scripts/jquery-3.1.1.js"></script>
<script src="~/Scripts/moment.min.js"></script>
<link href="~/Content/pignose.calendar.min.css" rel="stylesheet" />
<script src="~/Scripts/pignose.calendar.min.js"></script>
<div id="container" style="width: 100%; height: 700px; margin-top: 85px; white-space: nowrap;">
<div id="left3" >
</div>
<div id="right3">
<p class="blue-text" style="margin-top: 10px;"><b>Opening times</b></p>
<div class="calendar"></div>
</div>
</div>
<script>
$(function() {
$('.calendar').pignoseCalendar();
});
</script>
哪里可能有错误?
感谢您的帮助。
答案 0 :(得分:0)
您错过了这个。我们想首先在您的标头中添加此js文件。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
答案 1 :(得分:0)
我只是有这个问题。您可能已经在调用jquery并尝试使用从鼻烟日历获取的完整版js。
检查是否已经有jQuery,如果有,请停止使用完整版本,然后使用普通版本。如果您使用普通版本,则还必须添加moment.js。 您可以在这里下载:moment.js
之后,按如下所示调用initialize:
$(function () {
$('.pgcalendar').pignoseCalender();
})
现在应该可以正常工作了。
答案 2 :(得分:-1)
下载pignose.calendar.full.js文件
// for en will receive obj as
let en = {
"transfer-services": "transfer-services",
"about-info": "zhi-zhu",
"contact": "zhi-phi",
"all-services-from": "all-services-from",
"to": "to",
"sin": "sin",
"mal": "zmal"
};
// for zh will receive obj as
let zh = {
"transfer-services": "xi-hou-zhi-n",
"about-info": "zhi-zhu",
"contact": "zhi-phi",
"all-services-from": "hui-zhi-phi-tho",
"to": "zhi",
"sin": "stin",
"mal": "zmal"
};
// for hi will receive obj as
let hi = {
"transfer-services": "sabhee sevaen",
"about-info": "baare-mein",
"contact": "sampark-karen",
"all-services-from": "sabhee-sevak",
"to": "seh",
"sin": "sg",
"mal": "ml"
};
// will receive above obj base on curr_lang and prev_lang
function translationUrl(langvalue) {
switch (langvalue) {
case 'hi':
return hi;
case 'zh':
return zh;
case 'en':
return en;
}
}
function swapObj(val) {
const lang = Object.keys(val).reduce((a, c) => ({ ...a,
[val[c]]: c
}), {});
return lang;
}
function castObj(prev, curr) {
const lang = Object.keys(currObj).reduce((a, c) => ({ ...a,
[currObj[c]]: prevObj[c]
}), {});
return lang;
}
function transformURL(url, curr_lang, prev_lang, prevObj, currObj) { // convert prev to curr lang
let [base, lang, segment, ...rest] = url.split('/');
let obj = lang === prev_lang ? currObj : swapObj(currObj);
if (prev_lang !== 'en' && curr_lang !== 'en')
obj = swapObj(castObj(prevObj, currObj));
if (prev_lang !== 'en' && curr_lang === 'en')
obj = swapObj(prevObj);
Object.keys(obj).forEach(key => {
segment = segment.replace(key, obj[key]);
});
return [base, curr_lang, segment, ...rest].join('/');
}
let prev_lang = "en";
let curr_lang = "hi";
var prevObj = translationUrl(prev_lang);
var currObj = translationUrl(curr_lang);
console.log(transformURL('www.xyz.com/en/all-services-from-mal-to-sin?amount=1000&scy=SGD', curr_lang, prev_lang, prevObj, currObj));
console.log('www.xyz.com/hi/sabhee-sevak-ml-seh-sg?amount=1000&scy=SGD');
prev_lang = "hi";
curr_lang = "zh";
prevObj = translationUrl(prev_lang);
currObj = translationUrl(curr_lang);
console.log(transformURL('www.xyz.com/hi/sabhee-sevak-ml-seh-sg?amount=1000&scy=SGD', curr_lang, prev_lang, prevObj, currObj));
console.log('www.xyz.com/zh/hui-zhi-phi-tho-zmal-zhi-stin?amount=1000&scy=SGD');
prev_lang = "hi";
curr_lang = "en";
prevObj = translationUrl(prev_lang);
currObj = translationUrl(curr_lang);
console.log(transformURL('www.xyz.com/hi/sabhee-sevak-ml-seh-sg?amount=1000&scy=SGD', curr_lang, prev_lang, prevObj, currObj));
console.log('www.xyz.com/en/all-services-from-mal-to-sin?amount=1000&scy=SGD');