ShowMeDo Blogs the World
|
Site Relaunch – customizing that Twitter Widget Posted: 13 May 2010 08:47 AM PDT With limited time to post any content to the Blog or Twitter micro-blog, being able to reuse/advartise that content seems like a win-win. Twitter helpfully provide a widget for just this purpose but, out of the box, it’s not quite right for my purposes. But with a little javascript, jQuery and CSS magic that can all be put right. First a little screenshot to show what the vanilla widget looks like, after a bit of customization that you can perform on the Twitter site (you’ll find the widgets hanging off the ‘Goodies’ link at the bottom of your facebook page: The widget shown is ok but:
With a few a lines of css and jQuery javascript these problems are easily addressed. First we remove the header by finding its css class, ‘twtr-hd’, and using jQuery to hide it. This is equivalent to setting its css ‘display’ attribute to ‘none’. $('.twtr-hd').hide(); To change the padding and font-family just add some css to your style-file: div#contentRight .twtr-widget{ font-family:Verdana,Arial,Helvetica,"Trebuchet MS",Trebuchet,sans-serif !important; } .twtr-widget .twtr-tweet-wrap { padding:6px 0 !important; } Note the use of the !important flags to override existing settings and escape the css cascade. Now twitter themselves, rather frustratingly, set the widget font-style using an !important tag. This means that in order to override it we need to prioritise our !important using the identity ‘contentRight’ of the right column in which the twitter widget appears. Lastly, in order to direct users clicking the twitter badge to ShowMeDo’s twitter site we use a little jQuert to change the ‘href’ attribute of the twitter link: $('.twtr-doc a').attr('href', 'http://twitter.com/ShowMeDo'); And we have the resulting, pretty satisfactory widget: Related posts: |
You are subscribed to email updates from ShowMeDo Blogs the World
To stop receiving these emails, you may unsubscribe now. |
Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
sorry don't use facebook or twitter, I use identi.ca instead.
On May 14, 3:35 am, ShowMeDo Blogs the World <showm...@gmail.com>
wrote:
> ShowMeDo Blogs the World> Posted: 13 May 2010 08:47 AM PDThttp://blog.showmedo.com/showmedo-front-page/site-relaunch-customizin...
>
> ///////////////////////////////////////////
> Site Relaunch - customizing that Twitter Widget
>
>
> With limited time to post any content to the Blog or Twitter micro-blog,
> being able to reuse/advartise that content seems like a win-win. Twitter