- This topic has 0 replies, 1 voice, and was last updated 10 years, 2 months ago by macauba.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
macaubaMemberHi,
I am getting a strange javascript error that i can one can only simulate when generating an native app.
On test center everything runs smooth.I am inserting an HTML widget that loads the following code.
It adds and subtract wages on increment of 1, as i said evething goes fine on test center, but when i generate the native app, the first time you click on PLUS sign, it adds 2 instead of 1, only this first click and then it comes back working fine again.
It only happens if the project has panels with scrollbars an native app.Any Idea??
<script src="bootstrap/bootstrap.min.js"></script> <script> $(function() { var bfast320 = 14.10; var other320 = 56.40; $(".buttonss").on("click", function() { var $buttonss = $(this); var oldValue320 = $buttonss.closest('div').find("input").val(); if ($buttonss.text() == "+") { var newVal320 = parseFloat(oldValue320) + 1; } else { // Don't allow decrementing below zero if (oldValue320 > 0) { var newVal320 = parseFloat(oldValue320) - 1; } else { newVal320 = 0; } } $buttonss.closest('div').find("input").val(newVal320); $buttonss.closest('div').find("input").change(); }); $("#calc input[type=text]").keypress(function(event) { var controlKeys = [8, 9, 13, 35, 36, 37, 39]; var isControlKey = controlKeys.join(",").match(new RegExp(event.which)); if ((!event.which || (48 <= event.which && event.which <= 57) || isControlKey)){ return; } else { event.preventDefault(); } }); $("#calc input[type=text]").change(function() { var total320 = bfast320*parseInt($("#breakfast").val()) + other320*(parseInt($("#lunch").val())+parseInt($("#dinner").val())+parseInt($("#extra").val())); $('#total320').html(total320.toFixed(2)); }); }); </script> <style> .buttonss { } .tamanhoNmDiaria { width: 115px; } .divDiaria { margin-bottom: 15px; } .inputDiaria { text-align: center; color: #6A6A6A; font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif; } .centerDiaria{ width: 300px; margin: 40px auto; } .resultDiaria{ font-size: 20px; } body { padding: 0px; } .center { margin-left: auto; margin-right: auto; } .center.navbar .nav, .center.navbar .nav > li { float:none; display:inline-block; *display:inline; /* ie7 fix */ *zoom:1; /* hasLayout ie7 trigger */ vertical-align: top; } .center.navbar-inner { text-align:center; } .center .dropdown-menu { text-align: left; } .navbar-inner { margin: 0 auto; } @media (max-width: 767px) { .container,.container-fluid { padding-left: 10px; padding-right: 10px; }} </style> <div class="centerDiaria container"> <form id="calc"> <div class="input-group input-group-lg divDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default tamanhoNmDiaria"> CAFÉ </button> <button type="button" class="btn btn-default buttonss"> - </button> </span> <input type="text" id="breakfast" value="0" class="form-control input-number inputDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default buttonss ">+</button> </span> </div> <div class="input-group input-group-lg divDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default tamanhoNmDiaria"> ALMOÇO </button> <button type="button" class="buttonss btn btn-default btn-lg"> - </button> </span> <input type="text" id="lunch" value="0" class="form-control input-number inputDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default buttonss btn-lg">+</button> </span> </div> <div class="input-group input-group-lg divDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default tamanhoNmDiaria"> JANTAR </button> <button type="button" class="buttonss btn btn-default "> - </button> </span> <input type="text" id="dinner" value="0" class="form-control input-number inputDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default buttonss ">+</button> </span> </div> <div class="input-group input-group-lg divDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default tamanhoNmDiaria"> CEIA </button> <button type="button" class="buttonss btn btn-default "> - </button> </span> <input type="text" id="extra" value="0" class="form-control input-number inputDiaria"> <span class="input-group-btn"> <button type="button" class="btn btn-default buttonss">+</button> </span> </div> </form> <ul class="list-group" id="resultDiv"> <li class="list-group-item active resultDiaria"> TOTAL DE: R$<span id="total320">0</span> </li> </ul> </div>
-
AuthorPosts
Viewing 1 post (of 1 total)