How to enable current parent on uncheck?

With JavaScript how can you detect that there is overflow in an element and make a custom element appear to enable scrolling inside that element?

  • I am creating a blog theme where the post that has a set height. The text in the <article> will be scrollable if there is enough text to exceed past the height of its parent. The current aesthetic problem is the ugly standard scroll that cannot be modified for Firefox or Internet Exploder. I will find a way to hide the standard scroll bar. But  if (and only if) there is overflow, i want an element to appear at the  bottom left of the article to scroll up or down or scroll to top. But  that part does not matter what I want in that element. All I care about  at this point is to: Detect overflow Show element if overflow

  • Answer:

    If you use jQuery, you can try this: if ($('article')[0].scrollHeight > $('article')[0].innerHeight()) { //Text has over-flowed } And of course you can extract the same properties with plain JavaScript, with a little more work: document.getElementsByTagName("article")[0].scrollHeight

Marcello La Rocca at Quora Visit the source

Was this solution helpful to you?

Other answers

Well, in javascript you can always measure the difference between the offset height and the scroll height. var article = document.getElementsByTagName('article')[0]; if (article.scrollHeight > article.offsetHeight) { // article element has a scrollbar }

Mohab Samman

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.