1. in your node add below scripts.
<a href="#" id="togg-link">Click this link to toggle the content displayed below</a> <div id="togg"> This content will be toggled open and closed using jQuery. Blah, blah, blah. </div>
2. create a new file under /sites/all/themes/xxx/patrick.js
Drupal 6:
Drupal.behaviors.togg = function (context) { $('a#togg-link:not(.togg-processed)', context).addClass('togg-processed').each(function () { $(this).click(function() { $("div#togg").toggle(400); return false; }); }); };
Drupal 7:
(function ($) { Drupal.behaviors.togg = { attach: function (context, settings) { $('a#togg-link:not(.togg-processed)', context).addClass('togg-processed').each(function() { $(this).click(function() { $("div#togg").toggle(400); return false; }); }); } }; })(jQuery);
3, please clear drupal cache
4. try to refresh the node and see the effect
相关推荐
Drupal 8 Explained: Your Step-by-Step Guide to Drupal 8 (The Explained Series) by Stephen Burge English | 3 Apr. 2017 | ASIN: B06Y1VN2D7 | 283 Pages | AZW3 | 13.66 MB We're delighted to present the ...
You will then use Drush to apply a theme to Drupal, customizing everything to your liking, before publishing your work to the world. The book also covers some more advanced topics that beginners ...
For more advanced users, the book explains how to use the API to add custom configuration and how to upgrade custom modules to use the new Configuration Management system, covering some essential ...
If you are a developer who wants to use Drupal to enhance your website project and web application to manage content, this book is for you. Whether you are new to Drupal or an experienced web ...
You will learn how to architect and implement decoupled Drupal architectures across the stack―from building the back end and designing APIs to integrating with front-end technologies. You’ll also ...
Drupal的AddToAny模块是一个非常实用的工具,尤其对于那些希望增强网站社交分享功能的用户而言。这个模块专为Drupal 6设计,旨在提供一种简便的方式,让访客能够订阅、收藏网页内容,并且能够通过电子邮件轻松地将...
- **如何使用本书**(How to Use This Book) - 提供了指导读者如何根据自己的需求和兴趣来选择性阅读本书内容的建议。 - **Drupal 的工作原理**(How Drupal Works) - 解释了 Drupal 的基本架构和技术实现方式,...
Ideal for experienced Drupal developers, this book takes you through RWD basics and shows you how to build sites based on Aurora, Zen, and Omega—three popular base themes created by Drupal ...
#### 描述:本书为《The Definitive Guide to Drupal 7》(第一版),作者为 Benjamin Melançon,是一本详细介绍 Drupal 7 的专业书籍。 #### 知识点详解: ##### 一、Drupal 7 入门篇 1. **搭建 Drupal 7 网站 ...
Learn how to use HTML5 for responsive web design and semantic websites, and implement a better cross-compatible web application ☆ 出版信息:☆ [作者信息] Liran Tal [出版机构] Packt Publishing ...
This book is for nontechnical users who need to use Drupal to manage content, as well as PHP developers who are new to Drupal.
Failed to load config "@storybook/eslint-config-storybook" to extend from. Referenced from: /Users/daniel.lemon/coding/storybook-drupal-twig/node_modules/telejson/package.json @ ./node_modules/...
- To use Drupal's "Clean URLs" feature on an Apache web server, you will need the mod_rewrite module and the ability to use local .htaccess files. For Clean URLs support on IIS, see "Using Clean ...