Jump to content
  • Announcements

    • boen_robot

      Guidelines and Netiquette   03/28/2017

      Posting Problems:   Having problems posting your topic? Read through this: To join, you agree to our terms and conditions and fill out and submit a registration form. An activation email will be sent to your email adress, so you'll need to verify your account. After that the account has to be validated by one of the moderators. This will mean that it can take up to a day to be activated. A couple of things to remember to ensure approval: Don't use an email address in one of those $2 four character .com domains eg. xyds.com. These will be deleted and the domain added to the banned list. Don't use an email address that is within a domain with a bad reputation for spam. A Google search is run on every email address and email domain. Don't sign up with an email address that doesn't exist, doesn't work or requires the sender to answer a quiz before their email can get to you. Put your country and or state and city in the signup form. Blank forms will go to the botton of the "to do" list. And make sure that your email address and your country match, saying you're from Alabama and using a .ru email address is not going to get you activated. After a membership is activated the first few posts will be monitored. Posting spam or unapproved topics described in the agreement results in an immediate ban. The email provider and the IP addresses associated with the account will be banned and all posts will be deleted. These strict measures have been deemed necessary to hinder spam. Sorry for any inconvenience this causes, but it's not liable to change. If, after reading this, you still can't post and don't understand why, contact one of the Moderators listed here.   Topic Guidelines   Including the following information can expedite an accurate response from board members: Must be a Specific Problem or Question related to web design and development Include Code in Question (wrap with   for small blocks of code and for longer blocks   ) Include Code Author Include Extra Notes/Modifications/Attempts Include web link to page/file when possible Content Guidelines   You may not post, upload, link to, or email any Content that contains, promotes, gives instruction about, or provides prohibited Content. Prohibited Content includes any Content that breaks any local, state, county, national or international law. Prohibited Content also includes: No direct or indirect advertising or websites, forums, products, services No hijacking of posts (do not post your question in someone elses) Content that infringes upon any rights [ex. MP3s and ROMs] (including, but not limited to, copyrights and trademarks) Abusive, threatening, defamatory, racist, or obscene Viruses or any other harmful computer software False Information or libel Spam, chain letters, or Pyramid schemes Gambling or Illicit drugs Terrorism Hacking or cheating for internet/online games Warez, Roms, CD-Keys, Cracks, Passwords, or Serial Numbers Pornography, nudity, or sexual material of any kind Excessive profanity Invasive of privacy or impersonation of any person/entity Hacking materials or information Posting Tips   There are more BBcodes than there are buttons for on the reply menu. To get the full list, click "BB Code Help" underneath the clickable smilie face menu. Use   for small snippets of code Use   for lengthy snippets of code Use   if your snippet is HTML (optional) Use   if your snippet is SQL (optional) Rules of Conduct   Be nice. There's no need for calling someone stupid if they ask an 'easy' question. Keep your avatars and signatures absolutely child friendly. We have a younger audience on this forum. Keep your language appropriate for the same reason above. Do not PM moderators for help on the forum. Post on the topic, or create a new one.   Spam:   Recently, as you have all without doubt noticed, we have had lots of spam and advertisement on the forum. Therefore, we'd like to alert you as to what to do when you have found any of the aforementioned annoying messages: it. Immediately. Give a clear reason, please, if the advertising is not evident. DO NOT POST! Report, let the post stay as is, and we will get to it, meanwhile if you continue to post as normal in the other threads, it won't be on the top so long. Refrain from PMing the member. This won't help at all, as they are most likely spambots anyway. Thank you.       Images in signatures:   After thinking of users on dial-up, we have decided to enforce the following rules regarding signatures. Please pay heed to them. Respecting these rules is respecting the members on this forum with dial-up. Signature rules: No animated images AT ALL. No matter the amount of animation. Maximum image widthxheight: 300x150 Maximum image (file) size: 15kb Use calm colors. Do not use highly contrasting images in your signature, as this can get really annoying when seeing several posts from one member in the same thread. The same prohibited content goes for images as for posts. Lastly, use common sense. No lengthy signatures please. Save us some scrolling. Thank you.       Links in signatures:   Please understand that w3schools.com only exists because of voluntary work and is barely supported by the advertising littered throughout the tutorials and the forum. So, please, stop advertising other sites. DO not post links that drive traffic away from the w3schools domain - especially to a site that offers similar if not identical information. Please help support the site by keeping individuals on it. Thank you. Here are some guidelines as to what you can put in your signature: w3schools links --> allowed w3.org links --> allowed browser links --> allowed html editor links --> allowed personal sites --> allowed tutorial sites competing with w3schools --> NOT allowed sites completely irrelevant to webprogramming and this forum --> NOT allowed   Thanks for understanding, and for taking the time to read this. ~W3Schools Modstaff~
miguelito

Why do not the applications work on the tablet?

Recommended Posts

Why do not the applications work on the tablet?
Hi. I'm starting to create mobile apps with Cordova, for Android. I have small tests done with the help of peers
of this community.
But the problem is that I try to run them on the tablet and the interface only sees a small sample of
of the content. It does the job, but it goes much slower than on the mobile.
I imagine the key will be in css.
My question is, if I should add some plugin, configure css in some particular way, or some other file I must
do something What do I need to work on tablets and phones?
Maybe I do not explain very well or I do not give concrete data, but I can not think of it, I leave a sample of the code in case it is worth something.
Regards, and thank you very much.
Sorry for the spelling but I have to use the translator.

* {
    box-sizing: border-box;
  }
  
  .main {
    margin: 10px auto;
    width: 400px;
    height: 400px;
    margin-bottom: 5px;
  }
  
  body {
    background: grey;
  }

  #score{
    float: left

     }  
    .time{
    float:right;
     margin-right: 0px;
  }
  #start:hover{
    background-color:#477f4e;
  }
 
  #start{
  width:80px; 
  margin-left:220;
  margin-right:auto;
  margin-bottom:50px;
  border-style:solid;    
  border-radius:15px;
  border-width:1px;
  margin-top:7px;
  font-size:18px;
  }
  
  
  h1,
  p {
    font-family: open sans;
    margin: 5px auto;
    text-align: center;
    font-size: 95%;
  }
  
  .board {
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    width: 90%;
    padding-bottom: 90%;
    margin: 50px auto;
    border: 1px solid black;
    z-index: 0;
    box-shadow: 0px 0px 7px black inset;
    overflow: hidden;
  }
  
  .box {
    position: absolute;
    height: 33.33%;
    width: 33.33%;
    float: left;
    transition: 0.5s;
    background-image: url("../img/bob-patricio.jpg");
    box-shadow: 0px 0px 7px black;
    background-size: 300%;
  }
  
  .border {
    width: 100%;
    height: 100%;
    border: 1px solid black;
  }
  
  div.one {
    background-position: 0% 0%;
  }
  
  div.two {
    background-position: -100% 0%;
  }
  
  div.three {
    background-position: -200% 0%
  }
  
  div.four {
    background-position: 0% -100%
  }
  
  div.five {
    background-position: -100% -100%;
  }
  
  div.six {
    background-position: -200% -100%;
  }
  
  div.seven {
    background-position: 0% -200%;
  }
  
  div.eight {
    background-position: -100% -200%;
  }
  
  div.nine {
    background-position: -200% -200%;
  }

  #music{
    display: none; 
    autoplay: true;
  }
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" type="text/css" href="css/index.css">
  <link rel="stylesheet" type="text/javascript" href="js/index.css">
  <title>Document</title>
</head>

<body>

  <body>
    <div id="container">
      
        <div id="score">Movimientos = 0</div>
        <div class="time" id="sec">00</div>
        <div class="time">:</div>
        <div class="time" id="min">0</div>
        <div class="time">TIEMPO = &nbsp; </div>
        <div id="start">
          <span onclick="getNum()">INICIAR </span>
        </div>

      

      <div class="main">
        <div class="board" id="board">
          <div class="box one" id="1" onclick="change(1,0,0,1,1,0,0,1,1)" style="top:0%;left:0%;">
            <div class="border"> </div>
          </div>
          <div class="box two" id="2" onclick="change(2,1,0,1,1,0,0,0,1)" style="top:0%;left:33.33%;">
            <div class="border"> </div>
          </div>
          <div class="box three" id="3" onclick="change(3,1,0,0,1,1,0,0,1)" style="top:0%;left:66.66%;">
            <div class="border"> </div>
          </div>
          <div class="box four" id="4" onclick="change(4,0,1,1,1,0,0,1,0)" style="top:33.33%;left:0%;">
            <div class="border"> </div>
          </div>
          <div class="box five" id="5" onclick="change(5,1,1,1,1,0,0,0,0)" style="top:33.33%;left:33.33%;">
            <div class="border"> </div>
          </div>
          <div class="box six" id="6" onclick="change(6,1,1,0,1,1,0,0,0)" style="top:33.33%;left:66.66%;">
            <div class="border"> </div>
          </div>
          <div class="box seven" id="7" onclick="change(7,0,1,1,0,0,1,1,0)" style="top:66.66%;left:0%;">
            <div class="border"> </div>
          </div>
          <div class="box eight" id="8" onclick="change(8,1,1,1,0,0,1,0,0)" style="top:66.66%;left:33.33%;">
            <div class="border"> </div>
          </div>
          <div class="box nine" id="9" onclick="change(9,1,1,0,0,1,1,0,0)" style="top:66.66%;left:66.66%;">
            <div class="border"> </div>
          </div>
        </div>
      </div>
    </div>
    <img src="img\bob feliz.png">
    <iframe src="audio\BobEsponjaRemix.mp3" id="music"></iframe>

    <script type="text/javascript" src="js/index.js"></script>
  </body>

</html>
window.onload = alert("Hola...! disfruta de mi juego \nHaz clic en 'INICIAR', entonces debes colocar la imagen ... \nAsí que haz clic en la imagen...");

//establecemos el tiempo y los movimientos

var steps = 0;
var sec = "00";
var min = 0;
var seconds;
var minuts;
var div_sec = document.getElementById('sec');
var div_min = document.getElementById('min');
var classNames = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'];
function startTimer() {
    seconds = setInterval(secTimer, 1000); minuts = setInterval(minTimer, 60000);
}
function secTimer() {
    sec++;

    if (sec < 10) {
        sec = "0" + sec;
    }
    else if (sec > 59) {
        sec = "0" + 0;
    }
    div_sec.innerHTML = sec;
}
function minTimer() {
    min++;
    div_min.innerHTML = min;
}

function clearTimer() {
    clearInterval(seconds);
    clearInterval(minuts);

}
function resetTimer() {
    sec = "00";
    min = 0;
    div_sec.innerHTML = sec;
    div_min.innerHTML = min;
}


//cambiando la imagen

var numbers = document.getElementsByClassName("box");


function change(x, left, up, right, down, left2, up2, right2, down2) {
    var id = x;
    if (left == true && verIfEmpty(id - 1) == true) {
        steps++;
        changeContent(id, id - 1);

    }
    else if (left2 == true && verIfEmpty(id - 2) == true) {
        steps++;
        changeContent(id - 1, id - 2);
        changeContent(id, id - 1);

    }
    else if (up == true && verIfEmpty(id - 3) == true) {
        steps++;
        changeContent(id, id - 3);

    }
    else if (up2 == true && verIfEmpty(id - 6) == true) {
        steps++;
        changeContent(id - 3, id - 6);
        changeContent(id, id - 3);

    }
    else if (right == true && verIfEmpty(id + 1) == true) {
        steps++;
        changeContent(id, id + 1);

    }
    else if (right2 == true && verIfEmpty(id + 2) == true) {
        steps++;
        changeContent(id + 1, id + 2);
        changeContent(id, id + 1);

    }
    else if (down == true && verIfEmpty(id + 3) == true) {
        steps++;
        changeContent(id, id + 3);

    }
    else if (down2 == true && verIfEmpty(id + 6) == true) {
        steps++;
        changeContent(id + 3, id + 6);
        changeContent(id, id + 3);

    }
}

function verIfEmpty(x) {
    var a = document.getElementById(x);
    var c = a.innerHTML;
    if (c === "") {
        y = true;
    } else {
        y = false;
    }
    return y;
}

//Esta parte funciona gracias a Asier Villanueva

function changeContent(x, y) {
    var m = document.getElementById(x);
    var n = document.getElementById(y);
    n.innerHTML = m.innerHTML;
    n.className = m.className;
    m.innerHTML = "";
    m.className = "";
    win();
    showScore();
    ok();
}

//este generador aleatorio que encontré en internet


function randomGenerator(low, high) {
    if (arguments.length < 2) {
        high = low;
        low = 0;
    }
    this.low = low;
    this.high = high;
    this.reset();
}

randomGenerator.prototype = {
    reset: function () {
        this.remaining = [];
        for (var i = this.low; i <= this.high; i++) {
            this.remaining.push(i);
        }
    },
    get: function () {
        if (!this.remaining.length) {
            this.reset();
        }
        var index = Math.floor(Math.random() * this.remaining.length);
        var val = this.remaining[index];
        this.remaining.splice(index, 1);
        return val;
    }
}

//escribe los números al azar en el rompecabezas
//Esta parte funciona gracias a Asier Villanueva

function getNum() {
    var randomNoRepeatNumbers = new randomGenerator(0, 8);
    for (var i = 1; i <= 9; i++) {
        var newNumbers = document.getElementById(i);
        var rndNumber = randomNoRepeatNumbers.get();
        newNumbers.innerHTML = rndNumber;
        newNumbers.className = "box " + classNames[rndNumber - 1];
    }
    for (var i in numbers) {
        if (numbers[i].innerHTML == 0) {
            numbers[i].innerHTML = "";
            numbers[i].className = "";
        }
    }
    steps = 0;
    showScore();
    verifArray();
    clearTimer();
    resetTimer();
    startTimer();
    ok();
}



function win() {

    var time = min + ":" + sec;
    var win = true;
    for (var i in numbers) {
        if (numbers[i].innerHTML != numbers[i].id) {
            if (numbers[i].id != numbers.length) {
                win = false; break;
            }
        }
    }
    if (win) {
        clearTimer();
        function showAlert() {
            alert("Has ganado...!!! \nUsted hizo" + steps + "movimientos \nTu tiempo a sido " + min + " min. y " + sec + " sec.");
        }
        setTimeout(showAlert, 1000);

        //Modify the code with the help of @Asier Villanueva and it works perfectly

        var celda9 = document.getElementById('9');
        celda9.innerHTML = "9";
        celda9.className = "box nine";

    }
}

function showScore() {
    document.getElementById("score").innerHTML = ("MOVES = " + steps);
}

function verifArray() {
    var count = 0;
    var arrayNum = [];
    for (var i = 1; i <= 9; i++) {
        var w = document.getElementById(i).innerHTML;
        arrayNum[i] = w;
    }

    for (var i = 0; i <= arrayNum.length - 1; i++) {
        for (var n = i + 1; n <= arrayNum.length - 1; n++) {
            if (arrayNum[i] > arrayNum[n] && arrayNum[n] != 0) {
                count++;
            }
        }
    }
    if (count % 2 != 0) {
        getNum();
    }
}

function ok() {
    for (var i = 1; i < 10; i++) {
        var x = document.getElementById(i);
        if (x.innerHTML == i) {
            x.style.color = "#74a57a";
        } else {
            x.style.color = "#ffffff";
        }
    }
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×