views:

11

answers:

0

The Modularity Wordpress theme includes a "post slider" built around jQuery Cycle. It uses pager to display a small number above the sliders. I would love to be able to change that number into the post title.

The code in the theme is as follows:

 $doc_ready_script .= '

jQuery(function() {

   jQuery("#slider-posts").cycle({
       fx:      "scrollHorz",
       timeout:  0,
       prev:    "#prev",
       next:    "#next",
       pager:   "#slider-nav",
 containerResize: 0
   });

});';

I am NOT a jQuery coder (as you might be able to tell!) and I thought a simple adjustment to the code as follows would do the trick:

$doc_ready_script .= ' jQuery(function() {

   jQuery("#slider-posts").cycle({
       fx:      "scrollHorz",
       timeout:  0,
       prev:    "#prev",
       next:    "#next",
       pager:   "#slider-nav",
 containerResize: 0,
 pagerAnchorBuilder: function(idx, slide) { 
              return '<li><a href="#">' + jQuery(slide).children("h2").eq(0).text() + '</a></li>';
      }
   });

});';

However, I now get an error saying "Parse error: syntax error, unexpected '>'".

So, I realise that I have done something really daft!

Can some kind jQuery guru point me in the right direction please?

Many thanks in anticipation!