Posts by Gustavo Rodrigues • 2,184 points
48 posts
-
4
votes1
answer191
viewsQ: Javascript - How to improve this code?
As there is the Code Review Stack Exchange in Portuguese and Stack Overflow PT covers this topic I ask for help in a code that I am working on: suggestions and criticism regarding a chat script that…
-
2
votes2
answers88
viewsA: Cross-browser conflict at window width
Change that line: #missValMob, #namesJobsMob, #middleTextMob { display: inline-block; /* estava display: block; */ } This must have happened since the two browsers present differences in rendering,…
-
7
votes1
answer522
viewsA: How to trigger a function after a given date and time
The way you wrote best would be to compare numerical values: // Pega o valor numérico da data e hora: var time = (new Date('08/03/2014 23:45')).getTime(); setInterval(function() { // Compara com o…
javascriptanswered Gustavo Rodrigues 2,184 -
6
votes4
answers8962
viewsA: I cannot do an onchange event to change a photo when we select the select field
You must reference the element in the variable foto: as the value is a string it will be taken by value, not by reference; the element, being an object, will be taken by reference. var foto =…
-
0
votes1
answer598
viewsA: Jquery only validates one multi-element
$(".conceito").validate({...}) The jQuery Validation Plugin is used in elements <input>, but in elements <form>. This is what caused errors in the console because the plugin could not…
-
6
votes2
answers278
viewsA: How to remove bug from antialising lines generated in Firefox and IE?
As an example of the code has not been made available I cannot guarantee that it will work, but this code below disables the antialiasing which must be the cause of the problem: (source) .rebordo {…
-
5
votes5
answers3441
viewsA: Show text when typing in textarea
I’m willing! And since it’s completely different from the first answer: You don’t need to use jQuery: use CSS3 and if you need to, Vanilla JS or its equivalent in jQuery: Show text while textarea…
-
5
votes5
answers3441
viewsA: Show text when typing in textarea
Put a .stop(true) before the animations: (jsfiddle) $('#myTextarea').on('keyup',function(){ $('#showedText').text('Just a test!') .stop(true).fadeIn().delay(700).fadeOut(); }); The .stop() for the…
-
3
votes1
answer67
viewsA: Background panning after keydown effect
I arrived at that result: http://jsfiddle.net/95GhY/3/ I created vectors of speed and position, if the keys are pressed the speed will change as configured by the key mapping and start a loop by…
-
6
votes4
answers1082
viewsA: How to verify that the properties of the window object are native?
A native function will return function () { [native code] } when converted to string. var nativa = typeof funcao === 'function ' && funcao.toString().indexOf('[native code]') !== -1 On the…
-
9
votes4
answers1193
viewsA: Color loop in text
You don’t have to use <font>, that is obsolete. Prefer to use tags <span>. But you also don’t need to use so many classes and elements, it’s easier if you structure like this: <div…
-
2
votes2
answers255
viewsA: Multiple clicks
You can use the event/function .hover() together with the setInterval: // Cria uma variável para armazenar a referência ao intervalo: var intervalo; $('seletor').hover(function () { // Caso o mouse…
jqueryanswered Gustavo Rodrigues 2,184 -
10
votes2
answers424
viewsQ: What forms of data transfer are available to Javascript?
It is common to find questions, answers and tutorials talking about AJAX, which is nothing more than the XMLHttpRequest, as a form of data transfer between two computers. I wonder if there are other…
-
5
votes8
answers7818
viewsA: Check if variable contains a well formatted PHP email address
Use that library: http://code.google.com/p/isemail/downloads Remembering that depending on the library your results may vary, so it is important to use a library. If you’re going to use a regex…
-
4
votes1
answer235
viewsA: Creation of Table of Games
You can organize the data differently, it will depend on them and how you will present them. An example is to put them in a Array, to facilitate access to the different groups. var dados = [ […
-
2
votes2
answers1657
viewsA: How to display Google Analytics results on the website?
There’s a tutorial on how to use the Analytics API, available for Java, Python, PHP and Javascript. There are also libraries that simplify the use of its API: the google-api-php-client from Google…
-
3
votes3
answers1028
viewsA: How do I populate a $Scope (angular) with get. Json (jquery)?
With Angular, not preventing other forms, you stop working with $.getJSON and uses his own functions, such as $http: <table> <tr> <!-- Cabeçalho --> <th>X</th>…
-
3
votes3
answers469
viewsA: jQuery . toggleClass() is not working as expected
What is happening is not a jQuery fault, but a CSS function. It is organized in order of specificity, rules with higher priority are applied even if declared before those with lower specificity. A…
-
1
votes1
answer221
viewsA: Transition "Fill from left" into background
The code you placed is to move the button. If you want to move the background you can animate the position of it: (jsfiddle) .btn { background: #fff linear-gradient(90deg, #8f2 50%, #59f 50%);…
-
1
votes3
answers3827
viewsA: How to scroll infinity with pure javascript?
In a generic way to make an infinite scroll page is sort of like this, but in case what you want is to do like a parallax. Just like in the example of infinite scroll what you can do is prevent…
-
1
votes1
answer2714
viewsA: How to display registered values in a Google Drive spreadsheet in another via JS query
If you want to take the data from one sheet on another use this: (source) // Pega o conteúdo da A1 na Sheet1: =Sheet1!A1 // Caso a folha tenha espaços no nome use isso: ='Sheet number two'!B4…
-
0
votes3
answers4074
viewsA: Show/Hide animated information by clicking on the widget
Javascript free (jsbin): <div class="circulo" tabindex="0"> <div class="circulo--informacoes">Umas informações</div> </div> .circulo, .circulo--informacoes {transition: all…
-
1
votes2
answers999
viewsA: How to wait for the result of a Restful API in Nodejs
prodAdv.call("ItemSearch", options, function(err, result) { console.log(result); resposta = result; }); res.end(resposta); Did you mean: (I simplified the code and fixed the error of using the http)…
node.jsanswered Gustavo Rodrigues 2,184 -
0
votes2
answers889
viewsA: Is it possible to disable a certain action of an HTML element with a certain class via jQuery?
You returning a false value will prevent the default link and other events option as well: $("a.ui-multiselect-none, a.ui-multiselect-all, a.ui-multiselect-close").on("click", function(e) { return…
-
1
votes2
answers1217
viewsA: Error forcing download: Cannot Modify header information
Warning: Cannot modify header information - headers already sent by (output started at /home/inforcyb/public_html/opaco/header.php:15) in /home/inforcyb/public_html/opaco/index.php on line 181 HTTP…
phpanswered Gustavo Rodrigues 2,184 -
10
votes5
answers1876
viewsA: Retrieve a final value from a json in Javascript
Use the $.getJSON: $.getJSON(url, function (resultado){ // use o resultado });
-
4
votes3
answers4195
viewsA: How to insert an element between two elements?
Take the first div and insert after her: $('#fixedHeader_outer').after(HTMLString); I want to participate in the codegolf: if you do not want to use jQuery there is this option, as short as the…
-
3
votes1
answer277
viewsA: CSS incompatibility with jquery blockUI in IE 8
backgroundColor: "rgba(255, 255, 255, 0)", Colors written as RGBA are not supported in IE8. Use this: backgroundColor: "transparent",…
-
1
votes2
answers1209
viewsA: Use <Section> tag inside a <aside>
Of specification: Examples of sections would be Chapters, the Various tabbed pages in a tabbed dialog box, or the Numbered sections of a thesis. A Web site’s home page could be split into sections…
-
0
votes3
answers3834
viewsA: Google Maps coordinates via a Widget on a website
Use the Google Maps API and veincule a function to the event click: google.maps.event.addListener(marker, 'click', function () { console.log('Coordenadas:', marker.getPosition()); });…
-
4
votes3
answers7402
viewsA: Load refresh-free page post with AJAX and JQUERY
I think that’s what you need: $('#menu a').on('click', function () { /* to-do: mostrar ao usuário que há conteúdo sendo carregado se não o ele irá clicar novamente pensando que ocorreu um erro */ //…
-
5
votes1
answer506
viewsA: How do I catch the current percentage of a download?
What you are looking for is a progress event, which is updated as the download is processed. I have adapted your code based in that reply: $("#uptade_space_disk").click(function(){ var url =…
-
2
votes1
answer240
viewsA: Events.js: 72 error - Error running my first global app with express
Error: listen EADDRINUSE The port the express will use is already being used, choose another: the port is defined by that line app.set('port', process.env.PORT || 3000); in the app.js, soon change…
node.jsanswered Gustavo Rodrigues 2,184 -
0
votes5
answers213
viewsA: CSS Child selectors on IE8?
You can put classes in the elements that will use this style: #page-content .section-servicos .box-servico.ultima{ margin-right:0px; }…
-
3
votes1
answer990
viewsA: Generate securely random string in Nodejs
Use the module Crypto: var crypto = require('crypto'); crypto.randomBytes(tamanho, function (erro, resultado /*buffer*/) { if (erro) {throw erro;} console.log('Uma string aleatória de %d bytes: %s',…
-
0
votes2
answers189
viewsA: Chrome Mobile Android [Add to Homescreen]
With "hide the top and bottom bar" you refer the bars of the system, correct? The only way to remove them in Chrome for Android were videos: I tried to test if it’s possible use this on a website…
-
2
votes4
answers27486
viewsA: How to change the background with javascript?
You have to change the style of this span. Since it already has a color just change it: look for #EC2028 (or rgb(236,32,40)) in the rest of the code and switch to the color you want. Literally…
-
5
votes1
answer884
viewsA: When it is mandatory to use Javascript point and comma
Still the use of the semicolon is mandatory when using the loop for and when the line you follow starts with any of these you must finish the semicolon command: ([+-/* [source] In most cases, it…
javascriptanswered Gustavo Rodrigues 2,184 -
2
votes2
answers1256
viewsA: Make a site with multiple pages offline
Use the Application Cache, introduced in HTML5, would be the first idea to be thought out. On a site with one or two pages this works well and without harming the user experience: there are few…
-
6
votes2
answers1256
viewsQ: Make a site with multiple pages offline
Assuming I have a site with multiple pages - for example a blog - I want to put an option for those who visit it to have access to it without internet. Since not every device has constant internet…
-
2
votes3
answers5281
viewsA: Navigation without a refresh!
Create another page with the content you want to upload and then use it to upload the data. This makes it more organized and faster, since less data will be transferred. You can also simplify…
-
6
votes1
answer353
viewsA: Why am I losing the values of <input> when opening and closing a <iframe> using Javascript?
$('#pnlContent').html($('#pnlContent').html()+html); You are overwriting your HTML. Use this: $('#pnlContent').after(html);
-
3
votes3
answers1894
viewsA: Is it possible to import Javascript variables (Node.js)?
You can use with: with (G) { console.log(data); } The with is not widely used, nor recommended to use, as it puts all the properties of the object you are specifying as if they were global, which…
-
1
votes3
answers419
viewsA: In a menu of 3 levels, how to set a time when the event is mouseout on the second level to the third level?
Instead of creating a menu of your own - and because you’re already using jQuery - prefer to use a plugin that already does it for you: Plugins are usually tested, have mechanisms to avoid problems…
-
14
votes3
answers9448
viewsA: Javascript use of Eval(): what are the pros and cons?
The eval, in certain situations makes your code to be... ... harder to understand: javascript is being compiled on time, which, in addition to slowing down, makes it vary according to the variable…
-
2
votes3
answers955
viewsA: How to effectively remove the metatag refresh from a page?
It is possible, albeit by means of a trick: stop redirecting is not possible, but you can cancel it by doing, the moment the page is reloaded, redirect to an address that returns HTTP 204. If you…
-
6
votes4
answers359
viewsA: Difficulty storing object property in Javascript
Not always this will refer to the object you are creating: when you use this.addEventListener("click", this.handleClick); the value of this is no longer the object and becomes the global scope,…
javascriptanswered Gustavo Rodrigues 2,184 -
15
votes18
answers139957
viewsA: What is the best way to center an element vertically and horizontally?
There is no better way, it depends on what you are doing, for example if you want to support old browsers it is always better to use old techniques such as tables: .elemento-principal { display:…