Unit 3, ADS

Display entire contents of an iframe without scrolling

I want to display the entire contents of the iframe so that there is only the default browser scroll bar. I can not seem to get rid of the iframe verticle scroll bar. Any suggestions?

       

Hi, your code is working I can see vertical scroll bar in chrome,IE and Firefox So what is the problem with you ?

I do not want the scroll bar. I want the entire contents of the iframe to show up that I can see with the browser scroll.

@SarangaR are you in control of the iframe source? Each image in that googleDocs link has overflow: hidden . My demo shows an iframe with a normal page for src plnkr.co/edit/EFP750Fth4PTutwdK56Y?p=preview

I have added the code here so you can see what the problem is more clearly. plnkr.co/edit/rU6BIcKUkTzFksTuneuh?p=streamer The height of the document is dynamic and I want the div and iframe to expand to the height of the google document in the iframe so that no inner scroll is needed. Thank you

Источник

How to remove the scroll bar from iframe?

I used iframe for delivering an image icon for the pdf links in an html page. I have tried using overflow:hidden, scrolling: «no» etc for removing the scroll bar from iframe. But none of them is working in chrome. When tried in firefox,the scroll bar is removed,but image is not available. Please help me on this. Here is the complete code:

         /* one */ .imagewrap < display: inline-block; position: relative; >.icon-remove-sign < position: absolute; top: 0; right: 0; >iframe      

Источник

Remove scrollbar from iframe

This is how it appears (the shoutbox on homepage of http://www.talkjesus.com) How do I remove the horizontal scrollbar and modify the css of the vertical scrollbar?

18 Answers 18

Add scrolling="no" attribute to the iframe.

@MikePoole It might be officially obsolete, but it didn't help setting overflow:hidden; on Chrome 65.0.3325.181, but scrolling="no" helped.

This removed the scroll bar for me, but W3C Nu Html Checker now reports The scrolling attribute on the iframe element is obsolete.

This works in all browsers

 

Adding scroll="no" and style="overflow:hidden" on iframe didn't work, I had to add style="overflow:hidden" on body of html document loaded inside iframe.

If this helps, there is an issue in Firefox, where if you have an element CSS transform: scale(0.7) or such, this will create scrollbars (which will show up in your iFrame), unless you clip it with overflow: hidden; on an ancestor (could be a div instead of body).

loaded inside

Try adding scrolling="no" attribute like below:

seamless attribute has been removed in all major browsers

Just Add scrolling="no" and seamless="seamless" attributes to iframe tag. like this:-

 1. XHTML => scrolling="no" 2. HTML5 => seamless="seamless" 

If anyone here is having a problem with disabling scrollbars on the iframe , it could be because the iframe's content has scrollbars on elements below the html element!

Some layouts set html and body to 100% height, and use a #wrapper div with overflow: auto; (or scroll ), thereby moving the scrolling to the #wrapper element.

In such a case, nothing you do will prevent the scrollbars from showing up except editing the other page's content.

)" data-controller="se-share-sheet" data-se-share-sheet-title="Share a link to this answer" data-se-share-sheet-subtitle="" data-se-share-sheet-post-type="answer" data-se-share-sheet-social="facebook twitter devto" data-se-share-sheet-location="2" data-se-share-sheet-license-url="https%3a%2f%2fcreativecommons.org%2flicenses%2fby-sa%2f3.0%2f" data-se-share-sheet-license-name="CC BY-SA 3.0" data-s-popover-placement="bottom-start">Share
)" title="">Improve this answer
)">edited Sep 25, 2013 at 6:40
Kamil Budziewski
22.7k14 gold badges85 silver badges105 bronze badges
answered Sep 25, 2013 at 6:17
1
    7
    seamless attribute is not valid HTML5, not supported by most browsers (caniuse.com/#search=seamless), and most of the other styling is unnecessary.
    – Pere
    Apr 19, 2016 at 15:00
Add a comment|
6
iframe < display: block; border: none; /* Reset default border */ height: 100vh; /* Viewport-relative units */ width: calc(100% + 17px); >div

Like this you make the width of the Iframe larger than it should be. Then you hide the horizontal scrollbar with overflow-x: hidden.

Источник

Stop Iframe from preventing scrolling of parent document?

I seem to have the opposite problem of everyone else with iframes and scrolling. I need the iframe (contains a youtube video) to NOT prevent scrolling of the main document. If I hover my mouse over it, the page won't scroll with the scroll wheel, and according to the latest chrome canary simulation of touch devices, I can't put my finger on the frame and scroll the main document either. Any way to stop this? My CSS is below:

.GalleryVideoWrapper < position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; width:95%; margin:auto; display:block; >.GalleryVideoWrapper iframe

5 Answers 5

The question is unclear, so I went into some detail below on various ways to achieve this effect and how it works.

If you don't need to interact with the iframe, the quick and dirty solution is to use pointer-events: none; . This will put the iframe on the page, and not allow it to scroll. However, it also does not allow you to click on it. This obviously won't work for a YouTube video, but it is important to know this is an option.

If you need to interact with the iframe, either to play a video or click a link, all you need to do is make sure the iframe is large enough to display the full contents. I'm unsure what specific problem OP was encountering as we don't have their HTML, but if you scroll and the iframe is not also trying to scroll, it will not prevent the parent from scrolling.

Basically, if you have your cursor over an iframe and you scroll, the iframe will receive the event first. If it does not need to scroll (either it can't or it has already reached the bottom of the iframe) the event will be propagated to the parent.

Finally, if you have an iframe that you need to be scrollable, but you want to scroll the parent while the cursor is on the iframe, you are out of luck. There is no way to inform the iframe that sometimes the user wants to scroll the whole page. This is simply how iframes work. You can either remove the cursor from the iframe to scroll, or scroll to the bottom of the iframe and continue down the page.

Using a YouTube video and the CSS in the question, I've included a demo for you to see. I also included two identical iframes that are scrollable and applied pointer-events: none; to one to demonstrate how it works.

.tall < height: 1500px; >.GalleryVideoWrapper < position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; width: 95%; margin: auto; display: block; >.GalleryVideoWrapper iframe < position: absolute; top: 0; left: 0; width: 100%; height: 100%; >.scrolling-iframe < margin-top: 35px; display: inline-block; height: 500px; >.no-scroll
 

Источник

Игнорируем скролл в Яндекс.Карт и Google Maps

Игнорируем скролл в <iframe data-lazy-src=

Установили Яндекс.Карты на свой сайт? Использовали самую простую вставку - через iframe ? При попадании мыши в данный фрейм (и при прокрутке с телефона) экран не будет прокручиваться как Вам хотелось бы. А будет меняться локация на карте. Яндекс уверяет, что исправить это невозможно, и рекомендует использовать JS API , что более сложно и не всегда целесообразно. Вот ответ из Яндекс.Блога от сотрудника Яндекса: " поведения Виджета Карт в iframe настраивать нельзя ". Кстати, при использовании JS API в мобильной версии скролл карты всё равно остаётся, даже несмотря на рекомендуемый параметр scroll=false , который нужно использовать в параметре запроса, ведь по факту данный параметр отключает масштабирование колесом мыши, а у мобильных нет мыши и для них нужно использовать API и отключать поведение multiTouch .

В итоге, поняв масштаб данной проблемы, я написал несложный скрипт, с помощью которого Вы сможете не бояться за прокрутку внутри iframe , ни в мобильной, ни в десктопной версии Вашего сайта. Скрипт подходит как для Яндекс.Карт , так и для Google Maps .

Итак, как запретить скролл в Яндекс.Карт и у Google Maps аналогично

❶ Первым делом давайте оформим наш тег внутрь другого с идентификатором wrapMap :

id="wrapMap">

В элемент мы добавили инлайновый стиль с отключением кликов и прокрутки по карте (с помощью "pointer-events: none" ). В данном случае это не является дурным тоном и необходимо для дальнейшей работы скрипта.

❷ Затем давайте настроим активацию карты по клику на неё. Кстати, для удобства пользователей, давайте создадим интерактивную подсказку об этом и функционал для активации:

  

❸ Добавим немного стилей для обёртки карты и интерактивного элемента подсказки:

Пример работы скрипта:

Подписывайтесь на группу в ВКонтакте, вступайте в сообщество на Facebook, чтобы всегда быть в курсе актуальных выпусков
W e b d e v e l o p m e n t b l o g !

Источник

Читайте также:  Data index number html
Оцените статью