SlideShare uma empresa Scribd logo
1 de 20
jQuery for Drupal




  Drupaldelphia, May 14, 2010
Jody Hamilton

• Owner, Lead Developer at Zivtech
• Drupal architect, developer, themer, site-
  builder, project manager, teacher and
  student
• Jody Lynn on drupal.org
What is jQuery?


• http://jquery.com/
• “write less, do more”
Why is it so fun?

• Removes cross-browser pain
• Leverages your existing CSS knowledge
• Animates elements on the page
• Compact code
What’s it best at?
• Adding/Removing elements to/from the
  page
• Hiding/Showing elements
• Animating CSS transitions
• Responding to clicks, hovers, focus events
• Selecting from and traversing the DOM
Core Drupal jQuery

• Drupal adopted jQuery into core starting
  with Drupal 5
• In /misc: drag-and-drop ordering,
  expandable textareas, collapsible fieldsets,
  autocomplete, persistent table headers etc.
Syntax
http://docs.jquery.com/Types#jQuery

• $(“#page”).hide( );
• $(“a”).addClass(‘test’);
• $(“#page p”).click(function( {
     $(this).hide(‘slow’);
   });
Adding jQuery to a
         theme

• drupal_add_js(drupal_get_path(‘theme’,
  ‘MYTHEME’) . ‘/js/myfile.js’, ‘theme’);
• Add this to the top of template.php or in a
  specific theme function
Drupal behaviors
Sending settings to
        jQuery

• $setting = array(‘mySetting’ => $foo);
• drupal_add_js($settings, ‘setting’);
• access Drupal.settings.mySetting in jQuery
jQuery Release Cycle
• Drupal 6 has jQuery 1.2.6
• HEAD is on 1.4.2
Overriding js


• Override js functions by redeclaring
  afterwards
• ‘theme’ js loads after ‘core’ and ‘module’ js
Progressive
        Enhancement

• Build the page without relying on jQuery
• Fancify for additional coolness
AJAX
AJAX
Common Use Cases

• Show more content on a page with hide/
  show, tabs, accordions, rotators, modals
• Search bar with disappearing default value
• Slicker functionality with AJAX and AHAH
Popular Modules
• Lightbox2
                    • Hierarchical Select
• Vertical Tabs
                    • Views UI
• Quick Tabs
                    • jQ
• Views Carousel
                    • Views Accordion
• Beauty Tips
                    • Feedback
• Modal Frame API
jQuery UI


• http://jqueryui.com/themeroller/
• In core Drupal 7
Resources & Tools

• jquery.com
• Firebug for Firefox
• http://drupal.org/node/751748 handbook
Demo


• Let’s do this.

Mais conteúdo relacionado

Mais procurados

Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...tutorialsruby
 
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - WebinarCreating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - WebinarSuzanne Dergacheva
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalBrian Pichman
 
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...Mediacurrent
 
jQuery Mobile Introduction
jQuery Mobile IntroductionjQuery Mobile Introduction
jQuery Mobile IntroductionJoris Graaumans
 
Website Review with Screen Reader vs. SiteImprove
Website Review with Screen Reader vs. SiteImproveWebsite Review with Screen Reader vs. SiteImprove
Website Review with Screen Reader vs. SiteImproveTroyDeRego
 
BEST INSTITUTE FOR WEB DESIGNING
BEST INSTITUTE FOR WEB DESIGNINGBEST INSTITUTE FOR WEB DESIGNING
BEST INSTITUTE FOR WEB DESIGNINGwebdevelopment8
 
Best SEO Training Institute in North Delhi
Best SEO Training Institute in North DelhiBest SEO Training Institute in North Delhi
Best SEO Training Institute in North DelhiJessica Smith
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignDebra Shapiro
 
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can buildMonika Piotrowicz
 
Hammersmith fundamentals html fundamentals
Hammersmith fundamentals   html fundamentalsHammersmith fundamentals   html fundamentals
Hammersmith fundamentals html fundamentalsMike Bradshaw
 
Slides 3 - Wordpress Networks Sites
Slides 3 - Wordpress Networks SitesSlides 3 - Wordpress Networks Sites
Slides 3 - Wordpress Networks SitesMassimo Callisto
 

Mais procurados (17)

Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using <b>...&l...
 
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - WebinarCreating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
 
jQuery Mobile Introduction
jQuery Mobile IntroductionjQuery Mobile Introduction
jQuery Mobile Introduction
 
Mixbooks
MixbooksMixbooks
Mixbooks
 
Mixbooks
MixbooksMixbooks
Mixbooks
 
Mixbooks
MixbooksMixbooks
Mixbooks
 
Website Review with Screen Reader vs. SiteImprove
Website Review with Screen Reader vs. SiteImproveWebsite Review with Screen Reader vs. SiteImprove
Website Review with Screen Reader vs. SiteImprove
 
BEST INSTITUTE FOR WEB DESIGNING
BEST INSTITUTE FOR WEB DESIGNINGBEST INSTITUTE FOR WEB DESIGNING
BEST INSTITUTE FOR WEB DESIGNING
 
What is jQuery?
What is jQuery?What is jQuery?
What is jQuery?
 
Best SEO Training Institute in North Delhi
Best SEO Training Institute in North DelhiBest SEO Training Institute in North Delhi
Best SEO Training Institute in North Delhi
 
What is Modular CSS?
What is Modular CSS?What is Modular CSS?
What is Modular CSS?
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can build
 
Hammersmith fundamentals html fundamentals
Hammersmith fundamentals   html fundamentalsHammersmith fundamentals   html fundamentals
Hammersmith fundamentals html fundamentals
 
Slides 3 - Wordpress Networks Sites
Slides 3 - Wordpress Networks SitesSlides 3 - Wordpress Networks Sites
Slides 3 - Wordpress Networks Sites
 

Destaque

TTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO Viatecla
TTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO ViateclaTTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO Viatecla
TTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO ViateclaAssociação da Hotelaria de Portugal
 
Rays Of Light Final Kim Drynan
Rays Of Light Final   Kim DrynanRays Of Light Final   Kim Drynan
Rays Of Light Final Kim Drynandrynank
 
Overview of U.S. Leadership's Consulting Services
Overview of U.S. Leadership's Consulting ServicesOverview of U.S. Leadership's Consulting Services
Overview of U.S. Leadership's Consulting Servicesrickj41
 

Destaque (6)

TTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO Viatecla
TTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO ViateclaTTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO Viatecla
TTT Best Pactices Forum Hotel Distribution 30 Nov 2010 FARO Viatecla
 
Rays Of Light Final Kim Drynan
Rays Of Light Final   Kim DrynanRays Of Light Final   Kim Drynan
Rays Of Light Final Kim Drynan
 
Top modules
Top modulesTop modules
Top modules
 
Enas Fares
Enas FaresEnas Fares
Enas Fares
 
Ttt best practices forum hotel distribution 27 novembro ahp-hotrec
Ttt best practices forum hotel distribution 27 novembro   ahp-hotrecTtt best practices forum hotel distribution 27 novembro   ahp-hotrec
Ttt best practices forum hotel distribution 27 novembro ahp-hotrec
 
Overview of U.S. Leadership's Consulting Services
Overview of U.S. Leadership's Consulting ServicesOverview of U.S. Leadership's Consulting Services
Overview of U.S. Leadership's Consulting Services
 

Semelhante a jQuery for Drupal

Drupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouDrupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouAcquia
 
Fosdem 2009 – improving drupal's page loading performance
Fosdem 2009 – improving drupal's page loading performanceFosdem 2009 – improving drupal's page loading performance
Fosdem 2009 – improving drupal's page loading performanceErup Enolc
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014Mark Rackley
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationSean Burgess
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideMark Rackley
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesMark Roden
 
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointSPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointMark Rackley
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQueryMark Rackley
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
J query presentation
J query presentationJ query presentation
J query presentationakanksha17
 
J query presentation
J query presentationJ query presentation
J query presentationsawarkar17
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Drupal By Design - Business Case for Drupal
Drupal By Design - Business Case for DrupalDrupal By Design - Business Case for Drupal
Drupal By Design - Business Case for DrupalGlenn Lim
 

Semelhante a jQuery for Drupal (20)

Drupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouDrupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for You
 
Fosdem 2009 – improving drupal's page loading performance
Fosdem 2009 – improving drupal's page loading performanceFosdem 2009 – improving drupal's page loading performance
Fosdem 2009 – improving drupal's page loading performance
 
GCC 11-13-15
GCC 11-13-15GCC 11-13-15
GCC 11-13-15
 
GCC 11-13-15
GCC 11-13-15GCC 11-13-15
GCC 11-13-15
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014
 
Last Call Media Drupal 8 Case Study
Last Call Media Drupal 8 Case StudyLast Call Media Drupal 8 Case Study
Last Call Media Drupal 8 Case Study
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
DrupalCon 2011 Highlight
DrupalCon 2011 HighlightDrupalCon 2011 Highlight
DrupalCon 2011 Highlight
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointSPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuery
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
J query presentation
J query presentationJ query presentation
J query presentation
 
J query presentation
J query presentationJ query presentation
J query presentation
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Drupal By Design - Business Case for Drupal
Drupal By Design - Business Case for DrupalDrupal By Design - Business Case for Drupal
Drupal By Design - Business Case for Drupal
 

jQuery for Drupal

  • 1. jQuery for Drupal Drupaldelphia, May 14, 2010
  • 2. Jody Hamilton • Owner, Lead Developer at Zivtech • Drupal architect, developer, themer, site- builder, project manager, teacher and student • Jody Lynn on drupal.org
  • 3. What is jQuery? • http://jquery.com/ • “write less, do more”
  • 4. Why is it so fun? • Removes cross-browser pain • Leverages your existing CSS knowledge • Animates elements on the page • Compact code
  • 5. What’s it best at? • Adding/Removing elements to/from the page • Hiding/Showing elements • Animating CSS transitions • Responding to clicks, hovers, focus events • Selecting from and traversing the DOM
  • 6. Core Drupal jQuery • Drupal adopted jQuery into core starting with Drupal 5 • In /misc: drag-and-drop ordering, expandable textareas, collapsible fieldsets, autocomplete, persistent table headers etc.
  • 7. Syntax http://docs.jquery.com/Types#jQuery • $(“#page”).hide( ); • $(“a”).addClass(‘test’); • $(“#page p”).click(function( { $(this).hide(‘slow’); });
  • 8. Adding jQuery to a theme • drupal_add_js(drupal_get_path(‘theme’, ‘MYTHEME’) . ‘/js/myfile.js’, ‘theme’); • Add this to the top of template.php or in a specific theme function
  • 10. Sending settings to jQuery • $setting = array(‘mySetting’ => $foo); • drupal_add_js($settings, ‘setting’); • access Drupal.settings.mySetting in jQuery
  • 11. jQuery Release Cycle • Drupal 6 has jQuery 1.2.6 • HEAD is on 1.4.2
  • 12. Overriding js • Override js functions by redeclaring afterwards • ‘theme’ js loads after ‘core’ and ‘module’ js
  • 13. Progressive Enhancement • Build the page without relying on jQuery • Fancify for additional coolness
  • 14. AJAX
  • 15. AJAX
  • 16. Common Use Cases • Show more content on a page with hide/ show, tabs, accordions, rotators, modals • Search bar with disappearing default value • Slicker functionality with AJAX and AHAH
  • 17. Popular Modules • Lightbox2 • Hierarchical Select • Vertical Tabs • Views UI • Quick Tabs • jQ • Views Carousel • Views Accordion • Beauty Tips • Feedback • Modal Frame API
  • 19. Resources & Tools • jquery.com • Firebug for Firefox • http://drupal.org/node/751748 handbook

Notas do Editor