大家好。本人初用 drupal, 嘗試寫一些 module作測試。剛好見到 Druapl 有缺省載入 jQuery 於是跟從了以下網頁試
HOWTO: Add a jQuery effect, 但發覺好像沒有 Fadein 的效果, 那是因為我寫錯了東西嗎?以下是我的 code:
function test_menu(){
$items['test/go'] = array(
'title' => 'Test using jQuery javascript Fade-in effect',
'description' => '...',
'page callback' => 'test_jquery',
);
return $items;
}
function test_jquery() {
drupal_add_js (
'$(document).ready(function(){$("p.jtest").fadeIn(6000);}); ',
'inline');
$output = "<p class=\"jtest\" style=\"background-color: palegreen; width: 30em;\">
This is an example of an effect which is built into the core jQuery
library. This text should fade in after the DOM is loaded. <a
href=\"http://api.drupal.org/api/HEAD/function/drupal_add_js\">
drupal_add_js()</a> was used to add the <a href=\"http://jquery.com/api/\"> fadeIn</a> effect to any paragraph with the class <b>jtest</b>.
</p>";
return $output;
}我所使用的是 6.4 version, 煩著大家了, 謝謝


Re: 有關增添 jQuery 效果
應該沒錯
from open mind to open source~
document.ready時就fadeIn了,所以就算有效果也看不太出來
你可以寫一個click事件來看,就會很明顯
或是直接
alter($('.jtest').html());就可以看到測試的結果了--
Re: 有關增添 jQuery 效果
是用來作什麼的呢 ????