0
嗨我是相當新的moodle。我一直在試圖測試我的Javascript是否運行,但無濟於事。以下是我有:Javascript Moodle
在/ videojs/AMD/src目錄我做了一個test.js文件用一個簡單的命令
define(['jquery'], function() {
return {
init: function() {
// Put whatever you like here. $ is available
// to you as normal.
alert("It changed!!");
}
};
});
然後我呻吟了文件,一切都獲得成功,並取得了精縮。但是當我進入頁面時,它不會運行。現在我讀Moodle's Javascript Doc,我看到它說
The idea here is that we will run the 'init' function from our (PHP) code to set things up. This is called from PHP like this...
我在哪裏叫這個PHP?
你好! https://docs.moodle.org/dev/Media_players 我加入它在設置功能等故稱(/classes/plugin.php)和 '$ PAGE->所指> js_call_amd('media_videojs /測試','init');' 訣竅。 **謝謝!** –