Skip to content

Instantly share code, notes, and snippets.

@mpukit
Created September 20, 2017 14:25
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mpukit/423cfb4e5d073288e10d34d4c73ba37d to your computer and use it in GitHub Desktop.
Save mpukit/423cfb4e5d073288e10d34d4c73ba37d to your computer and use it in GitHub Desktop.
Twitter Embedded Timeline CSS Override
<div class="twitter-feed">
<div class="container">
<div class="row">
<div class="col-md-12">
<!-- Twitter Embed Code -->
<a class="twitter-timeline" href="https://twitter.com/UPMCPhysicianEd"
data-chrome="noheader nofooter noborders transparent noscrollbar"
data-tweet-limit="1" dnt="true">Tweets by UPMC Physician Education</a>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<!-- / Twitter Embed Code -->
</div>
</div>
</div>
</div>
// Twitter Overrides -----------------------------------------------------------------------------
$('.twitter-feed').delegate('#twitter-widget-0', 'DOMSubtreeModified propertychange', function () {
customizeTweetMedia();
});
var customizeTweetMedia = function () {
// CSS Overrides
$('.twitter-feed').find('.twitter-timeline').contents().find('.timeline-Tweet-media').css('display', 'none');
$('.twitter-feed').find('.twitter-timeline').contents().find('img.Avatar').css('display', 'none');
$('.twitter-feed').find('.twitter-timeline').contents().find('span.TweetAuthor-avatar.Identity-avatar').remove();
$('.twitter-feed').find('.twitter-timeline').contents().find('span.TweetAuthor-screenName').css('font-size', '16px');
$('.twitter-feed').find('.twitter-timeline').contents().find('span.TweetAuthor-screenName').css('font-family', 'Raleway');
$('.twitter-feed').find('.twitter-timeline').contents().find('p.timeline-tweet-text').css('font-family', 'Libre Baskerville');
$('.twitter-feed').find('.twitter-timeline').contents().find('p.timeline-tweet-text').css('font-size', '16px');
$('.twitter-feed').find('.twitter-timeline').contents().find('p.timeline-tweet-text').css('line-height', '1.6');
$('.twitter-feed').find('.twitter-timeline').contents().find('ul.timeline-tweet-actions').css('display', 'none');
// Call the function on dynamic updates in addition to page load
$('.twitter-feed').find('.twitter-timeline').contents().find('.timeline-TweetList').bind('DOMSubtreeModified propertychange', function () {
customizeTweetMedia(this);
});
}
@robertmarkbram
Copy link

Brilliant - thank you for this.. a simply presented way to customise CSS in the new Twitter embedded stream that for some strange reason doesn't provide an easy way to customise CSS.

@snowjorden
Copy link

This is brilliant. My only question. Is there a way to make the entire thing fit inside something 180px wide? Height's not a issue. Thank you.

@onlinegraphics
Copy link

I could use some help with this GIT ...

I placed the script in the HEAD and also tried just before BODY close in Wordpress ... the overrides are not taking. Can you help me to understand this one a bit better?

Thanks heaps ...
Woody House
Online Graphics

@Ranjodhsandhu
Copy link

Hi thanks for this code, It is working fine but I get this warning "Use of Mutation Events is deprecated. Use MutationObserver instead." and also the browser stops and shows a pop up to stop or wait for the script to finish.

Help is appreciated.
Thank you please

@sazzad23
Copy link

sazzad23 commented Sep 2, 2020

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment