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

Tags: , , , , ,

7 comments

  1. great post! ♥

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

    • 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.

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

    • 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.

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

Leave a comment


Load Times Plugin made by Ares Free Download