The IJC Digital Blog

Posted by: Matt Mansour 5 years, 7 months ago (0 comments)

A recent web development project of mine required integration of a fancy looking Twitter social widget. Luckily the Content Management System I used has a Twitter API module, which gave me complete freedom to implement the design requirements. However, the Twitter module that shipped with that CMS did not open a new browser window when a link in the Twitter feed was clicked.  I did not want to hack into the Twitter module of the CMS in this context. I ended up implementing the following JQuery snippet; which made the task of opening a new browser window easy. With the code snippet below all anchor tags in the 'tweets' class get their target attributes set to '_blank'.

$('.tweets > li').click(function(event){
   $(this).find('a').attr('target','_blank');
});

I originally found the variation of this on stackoverflow.com...

...and yet another happy moment in Django land.

Current rating: 3.3

Comments