Alex Burrows Design

Alex Burrows Design is a freelance web & design company based in the heart of Surrey in the small town of Ashtead.

  • home
  • services
  • work
  • contact
  • blog
  • offers

Categories

  • Clients
  • Personal Stuff
  • Reviews
  • Techy Chat
  • Tutorials
    • Drupal
    • jQuery

Bring the parent along to

Posted on February 11th, 2010 by Alex


Ok so had an issue with wanting to show the parents title in the childs seperate navigation in Drupal.

Using menu_block_split module I can achieve splitting the navigation up, but not bringing the title of the parent with it.

In the block tpl file called block-subnav.tpl.php (note: subnav is the region in my drupal template, so may be different for you.) I added a div called subtitle.

My block tpl file looks like this

<div class="subtitle"></div><?php print $block->content ?>

So in my jQuery I added this:

var $linktitle = $("#nav ul.primary-links li.active-trail a").attr("title");
$(".subtitle").append("<h2> " + $linktitle + " </h2> ");

#nav ul.primary-links li.active-trail a

This is the absolute path for the html element I want, so I make that into a variable.

Then using jQuery I use the append() function and insert the title into the code.

Tags: CSS, Drupal, jquery

One Response to “Bring the parent along to”

  1. ezikulezecaf Says:


    ezikulezecaf…

    Download mp3 with Yuki Kajiura …

    March 27th, 2010 at 7:12 am

Leave a Reply


Interesting Events

JavaScript Conference - 20th November
  • rssRSS Entries
  • rssRSS Comments

Archives

  • February 2010
  • October 2009
  • July 2009
  • May 2009
  • April 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • August 2008

Search Blog

© 2010 Alex Burrows Design. All Rights Reservered.
Valid XHTML & CSS
Blog Powered by WordPress