Interactivity between the html and the app

10 views
Skip to first unread message
is duplicateview conversation

Osama

unread,
Aug 27, 2019, 1:50:03 PM8/27/19
to MIT App Inventor Forum
Hello friends,

I need help in order to work out the interactivity between the html and the app using the webviewstring to make a swipe between pages  using Webviewer . A counter is here in the html on each swipe (using a variable!) but how can I do it to send a value back to the app using webviewstring for the app to serve up a different page.

<script>
var counter = 0; // will reset each time the page loads, so you may need a WebViewString value passed by the app to set this ? !!!
var pages = 20; // for example - also could be set by WebViewString vlaue from app
</script>

<script>
         $(document).on("pagecreate","#page1",function() {
            $("body").on("swipeleft",function(){
if ( counter !== 0 ) { counter = counter - 1; 
            $("span").text(counter);
    };
            });
         });
         
 </script>
 <script>
         $(document).on("pagecreate","#page1",function() {
            $("body").on("swiperight",function() {
if ( counter !== pages ) { counter = counter + 1;
            $("span").text(counter);
    }
            });
         });
         
 </script>

blocks (1).png
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages