1

I have an iframe with scrolling: no option. For all mobile devices, I want to scroll over the iframe, in other words, when I vertically scroll down on iframe using fingers, the parent page doesn't scroll at that time.

Thanks in advance.

Rahul Singh
  • 101
  • 8

1 Answers1

1

if you use mobile add scrolling else set "no"

var iframe = document.querySelector("iframe");
if (/Android|webOS|iPhone|iPod/i.test(navigator.userAgent)) {
  iframe.setAttribute("scrolling", "yes");
} else {
  iframe.setAttribute("scrolling", "no");
}
<iframe src=""></iframe>
לבני מלכה
  • 15,925
  • 2
  • 23
  • 47
  • You didn't get the point. I don't want to scroll the iframe itself. I want to scroll the parent window to scroll when we touch over iframe ( try to vertically scroll with fingers over iframe). – Rahul Singh Aug 16 '21 at 08:33