Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As @geet said, localStorage is what you need to store datas and retrieve them later. According to Phonegap website, localstorage provides access to a W3C Storage interface. You can read about it here : <a href="http://dev.w3.org/html5/webstorage/#the-localstorage-attribute" rel="nofollow">http://dev.w3.org/html5/webstorage/#the-localstorage-attribute</a>.</p> <p>To save a toggle button position this is what I do :</p> <pre><code>&lt;script&gt; function onDeviceReady() { // Set togglebutton to false default var togglebutton = window.localStorage.getItem("togglebutton"); if (togglebutton==null) window.localStorage.setItem("togglebutton", 'false'); // Set default state if (window.localStorage.getItem("togglebutton")=='true') { $('#onoffswitch').attr("checked", "checked"); } // Switch onoffswitch event $('#onoffswitch').on('change', function(){ if ($(this).prop('checked')) { window.localStorage.setItem("togglebutton", 'true'); } else { window.localStorage.setItem("togglebutton", 'false'); } }); } &lt;/script&gt; </code></pre> <p>Make sure in your HTML that your toggle element (form me a checkbox) isn't checked by default :</p> <pre><code>&lt;input type="checkbox" name="onoffswitch" id="onoffswitch"&gt; </code></pre> <p>About Pause and Resume, you can perform actions when these events are called. To do this :</p> <pre><code>&lt;script&gt; document.addEventListener("resume", yourCallbackFunction, false); document.addEventListener("pause", yourCallbackFunction, false); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload