我希望我的Drupal中的按鈕能夠在javascript無法使用的情況下正常退化,方法是將用戶指向完整節點。當沒有可用的JavaScript時,在drupal中優雅地降級jquery。想法?
我在我的Drupal node-type-tpl.php的頭部有這個jquery javascript代碼;
Drupal.behaviors.infobutton = function(context) {
$("button").click(function() {
$('.more').hide();
$('.more').eq($('button').index($(this))).show();
});
}
這是在我的node-type-tpl.php中的表中的一行中的按鈕,
<button>More</button>
這是表中的下一行,被css隱藏,直到我點擊我的按鈕;
<tr class="more"><td>some php content</td></tr>
當前用戶在視圖中看到一個修剪下來的節點。此節點打開後可以在點擊按鈕時顯示更多內容。我想,爲了讓用戶定向到完整的節點,如果javascript被關閉。
任何想法我可以做到這一點?
嗚呼!這工作。對代碼進行一些修改; Drupal.behaviors.morelink = function(context){(「a.morelink」)。click(function(e){e.preventDefault();) $('。more')。hide(); $('。more')。eq($('a.morelink')。index($(this))).show(); }); }'和'More' – Meggy 2012-04-14 11:48:44