I have written code which responds to an image begin clicked by auto clicking a link in the navigation bar by the following code:
$('body.node-4 div#block-views-Poster-block_1 img.imagecache-Posters').addClass('manually-linking').click(
function(){
//$('body.node-4 div#block-menu-primary-links ul li a.menu-224').css('color', 'red').trigger('click');
$('body.node-4 div#block-menu-primary-links ul li a.menu-224').css('color', 'green').click();
}
);
In each case, .trigger('click') and .click(), I am applying color via CSS to the target link. When the image is clicked, the target link changes color but the navigation to the relevant page never happens.
What might I be doing wrong?
Wouldn’t it be easier to simply redirect to that URL, instead of actually triggering the click?
I assume you are changing the colour of the link, merely to confirm that it targets properly (as it will of course be reset, when the page reloads).