Skip to content

Add a Twitter @anywhere hovercard to links containing tweeps

Everyone and their dog has a walkthrough of adding @anywhere hovercards to your blog. But the default has a small failing that irked me when I was re-doing my Blogroll (check them out, they’re all great! I promise!), and that was that if you take a tweep, like @god for example, it’ll happily wrap the hovercard around it, but if you have a link to this great status that @god posted, @anywhere won’t pick this @god up.

Quick and dirty solution; add the following code-block inside your

onAnywhereLoad(twitter)

section of script.

twitter("a").hovercards({
infer=true
});

Then thats you done! No muss, no fuss.
Thanks go to @stuartgibson for help.
If I’ve missed anything, scream at me in the comments or @bolster

Update
Of course I’d missed something; this unfortunately makes @anywhere inspect every link on your site, including navigational ones, so for my usecase (blogroll), i modified my code to only infer when inside the id of my blogroll, ie

twitter("#linkcat-2 a").hovercards({
infer=true
});

YMMV

{ 6 } Comments

  1. arvee marie | 2010/08/30 at 03:11 | Permalink

    great post! ♥

    Yet do you know how to make it open on a new window?

  2. Bolster | 2010/08/30 at 03:25 | Permalink

    AM, Glad you found it helpful!
    I have not tested this, but I believe if you change the relevant section of your code to include a window: _blank reference (your milage may vary, and your code may look completely different)

    twttr.anywhere({ window: _blank }, function (T) {
    // Your code here
    });

    That should send it out to a new window.

    My condolences regarding Clottey.

  3. arvee marie | 2010/08/30 at 05:32 | Permalink

    I tried your _blank code as well as twitters myframe code, doesn’t work.

  4. Bolster | 2010/09/02 at 15:25 | Permalink

    What browser are you using? I’ve tested it in chrome + firefox and it appears that the default action for clicking on the username is to open their stream in a new tab / window.

  5. arvee marie | 2010/09/02 at 16:25 | Permalink

    I’m using firefox. I now totally get what you’re saying… Thanks a lot… ♥

  6. Bolster | 2010/09/02 at 16:29 | Permalink

    Not a problem, glad you found it helpful!

{ 1 } Trackback

  1. [...] goes out to Andrew Bolster for the infer: true part of my [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *