1

How to customize the twitter iframe scroll bar(in embedded tweets widget) as per my design. Please let me know how i will do the change of default design ?

Mrinmoy Majee
  • 366
  • 1
  • 13

1 Answers1

1

As mentioned in this question, if you want to change the style of the contents of an iframe, the most common way is to use Javascript to append CSS code into the rendered iframe's head tag.

However, there is a timing issue when you try to do that. Since Javascript runs your code when the DOM is ready, if the Twitter widget takes too long to fetch tweets, your style won't be applied to the iframe.

To fix this, there's a small function that helps you to run your JS code after an element is inserted to the DOM. It was all mentioned in this answer.

So, here's the formula:

$("iframe#twitter-widget-0").contents().find('head').append('<style>' + 'YOUR CSS RULES' + '</style>'); 

You should set the styles of the scrollbars by using this piece of code, here's an example about styling scrollbars.

To make things clear, I've created a fiddle: http://jsfiddle.net/kublaios/c3j109md/

Community
  • 1
  • 1
kubilay
  • 5,047
  • 7
  • 48
  • 66