Blog
Drupal and jQuery
What is jQuery?
jQuery is a wonderful JavaScript library that allows you to create great web effects with just a few lines of code. As stated on the official jQuery website:
"jQuery is a JavaScript library whose motto is: writing JavaScript code should be fun. jQuery handles common, repetitive tasks, cleans up layouts, and keeps code short, beautiful, and understandable."
Drupal and jQuery. Lesson 1. Connecting a file with jQuery.
jQuery is a very handy tool when you need to hide something, modify it, move it, insert it nicely, and disappear. Very, very convenient and very simple. Let's connect a JavaScript file. To attach files to a theme, we use the `.info` file in your theme. To include the file, add the following line to your theme's `.info` file:
scripts[] = js/custom.js
where `js/custom.js` is the path to the JavaScript file in your theme.
Drupal and jQuery. Lesson 2. Selectors, effects.
In this lesson, we will explore jQuery selectors and jQuery effects.
Selectors
Among selectors, we will most often use classes and IDs. Selectors generally correspond to CSS selectors, so if you know how to write selectors in CSS, you already know how to write them in jQuery. Here's how we select classes:
$('.class')
And here's how we select IDs:
$('#id')
Drupal and jQuery. Lesson 3. jQuery and CSS
In this video, we will explore how to work with CSS using the capabilities of jQuery.
Drupal and jQuery. Lesson 4. jQuery and events
In this lesson, we will cover events in jQuery. We will also get acquainted with the animate()
method, which allows us to create animations. Using events and animate()
, we’ll build an animated contact form.
jQuery and Drupal. Lesson 5. jQuery online calculator, sexy uniform
In this video, we’ll learn how to use jQuery to create an online calculator. We’ll also connect the Sexy Uniform plugin to make our buttons look stylish.
jQuery and Drupal. Lesson 6. jQuery Photo Gallery
In this lesson, we’ll look at how to create a simple photo gallery using jQuery.
jQuery and Drupal. Lesson 7. Search field on jQuery, events Focus and Blur
You've probably seen a search field with the word "Search" in it, which disappears when clicked so you can type your query. Below is a jQuery snippet for that functionality:
Drupal and jQuery. Lesson 8. Connecting jquery ui, jquery ui tabs to drupal 7
File code
/sites/all/modules/custom/custom.info
name = custom description = custom module core = 7.x
/sites/all/modules/custom/custom.module
CSS code:
#tabs { border: 0px; } .ui-tabs-nav { background: none; border: none; }
HTML code in node-product.tpl.php:
PHP Lessons (textbook, self-study)
Why Create Yet Another PHP Tutorial?
I haven't yet come across a truly simple and gradual tutorial for complete beginners that explains PHP from the very basics. Most tutorials assume you already know what a function, recursion, variable, or data type is—as if everyone has C++, Pascal, or Basic ingrained in their memory.