You are using the selector 'a[href="#content"]'
in jQuery but the href
attribute of the target links is #content<?php echo $i; ?>
. Try removing <?php echo $i; ?>
in the href
attribute.
If you need jQuery code recognise all <a>
elements with href
starting with the string “content” you can use the ^
modifier: jQuery('a[href^="#content"]')
. So your code will look:
jQuery('a[href^="#content"]').fancybox({
autoSize : false,
width : 600,
wrapCSS : 'inline-content'
});
Note that using $
namespace in WordPress like you are using it can cause javascript errors because in WordPress jQuery runs in noConflict mode.