WebView Slide (Android & iOS)

Hi,

I have a project where I have to use multiple webviews and I need to slide/swipe between them.

I found a nice tutorial “BackSwipe navigation”,but it can be applied to webviews?If not is there any way for me to slide/swipe among my webviews?

Thanks!

https://code.coronalabs.com/code/backswipe-navigation-composer

Hi @bogdanmocanu2,

Well, I can’t provide any advice/support on that module you found, but you should be able to move a webview via its x/y position, and thus accomplish what you need.

Brent

Hi Brent,

My webview does not respond to simple touch events,such as moving it.

Hi @bogdanmocanu2,

Hmmm, that could be a problem. Have you tried using a Runtime touch listener and checking if you receive a touch “on top” of the web view? If you do get those events, I think you could build your swipe/slide implementation that way.

Brent

Hi Brent,

I did that with no succes.Here is the code.

local web= native.newWebView (display.contentCenterX,display.contentCenterY,320,588) web:request ("http://google.ro/") local function Swipe (event) if event.phase == "began" then web:request("http://www.youtube.com/"); local alert = native.showAlert( "Corona", "Works", { "OK", "Learn More" }, Swipe) end end web:addEventListener("touch",Swipe);

Hi @bogdanmocanu2,

Well, I can’t provide any advice/support on that module you found, but you should be able to move a webview via its x/y position, and thus accomplish what you need.

Brent

Hi Brent,

My webview does not respond to simple touch events,such as moving it.

Hi @bogdanmocanu2,

Hmmm, that could be a problem. Have you tried using a Runtime touch listener and checking if you receive a touch “on top” of the web view? If you do get those events, I think you could build your swipe/slide implementation that way.

Brent

Hi Brent,

I did that with no succes.Here is the code.

local web= native.newWebView (display.contentCenterX,display.contentCenterY,320,588) web:request ("http://google.ro/") local function Swipe (event) if event.phase == "began" then web:request("http://www.youtube.com/"); local alert = native.showAlert( "Corona", "Works", { "OK", "Learn More" }, Swipe) end end web:addEventListener("touch",Swipe);