Posts by Afonso • 553 points
26 posts
-
1
votes2
answers69
viewsA: How to make a link of the child element open when clicking on a div?
I suggest you use the element <a> as the card itself. Something in that line: <article> <a href="http://www.artigo3.html"> <img…
-
0
votes1
answer23
viewsA: How to get dynamically generated ID (JS or Jquery)?
You can pass the function fecharModal which element is being clicked, and through this close only the modal where it is. In this case, when adding the modal, the function called in the onclick can…
-
0
votes1
answer25
viewsA: Is there any method to return the URL of the chosen file in a "file" input element?
No. When you choose a file through a input[type="file"], the browser makes available the bytes of that file to be sent to a server on the web. There is no native way to upload this to the web and…
javascriptanswered Afonso 553 -
0
votes1
answer58
viewsA: how do I define where my scroll animation(jquery) should end up as a string on the page
In the final position that you pass to the function of Animate, you need to subtract the height of this fixed header. That is, the coordinate will be the placeDoConference - highDoHeader. For…
-
3
votes1
answer2303
viewsA: background image does not go out in print (using window.print)
In Chrome and Safari you can add the CSS rule: -webkit-print-color-adjust: exact; This will force the browser to print colors and background images. Source:…
-
1
votes1
answer48
viewsA: Shopping Cart - Contactor alert of products within the same
You can simply count how many products are added (assuming this exists within some element of the shopping cart), and add that content to the icon with a tag <span>, styling with CSS - no need…
-
1
votes2
answers2726
views -
0
votes2
answers1990
viewsA: How to insert items from a JSON file into an html table
You can create a table template and render from JSON. I particularly like the Mustache very much: https://github.com/janl/mustache.js/. It is a very simple and fast plugin. Basically, you’d have…
-
2
votes1
answer71
viewsA: Can anyone tell me why this image (css) isn’t loading?
To div is not an element that can be closed in on itself. Therefore, <div id = "topo"/> is wrong. The correct is <div id="topo"></div> Moreover, the div does not have defined…
-
1
votes2
answers99
viewsA: Minimize CSS file with Grunt
To minify files CSS, a widely used package is the grunt-contrib-cssmin. You can install via command npm install grunt-contrib-cssmin --save-dev. Once installed, you need to load the package into…
javascriptanswered Afonso 553 -
2
votes2
answers431
viewsA: Div with other Divs inside
In fact this leak occurs because of the edges. In the way that the CSS works, each element has the height in percentage plus the size of the border. Example: the height of the .tela_titulo yeah,…
-
4
votes5
answers1538
viewsA: How to run an event once?
A simple solution: $('.oi').on('mouseenter', function(){ alert('OLÁ'); $('.oi').off('mouseenter'); }); As the method on adds events to an element, the off removes these events.…
-
2
votes4
answers3072
viewsA: How to leave a height-height fixed on the page?
My approach would be as follows: involve the entire "page" in a div .container, with defined width and height. div.container{ position: relative; width: 100vw; height: 100vh; } The units vw and vh…
-
2
votes2
answers114
views -
2
votes1
answer81
viewsA: JSON return giving as undefinided in jQuery
The navigation by the JSON object takes place with point, ie to access the value of nome, you must use data.nome. Also, I suggest to clarify that you expect a JSON as return, with the parameter…
-
2
votes3
answers4067
viewsA: Use "text-overflow" with "height"
It is possible to add ellipsis to a block element when the text has only one line. Otherwise, only with a little programming, as shown in another answer. To set this property in CSS, the basic code…
-
0
votes2
answers63
viewsA: Avoid zooming inside a textarea
A widely used hack is to set the font size to 16px. @media screen and (max-width: 640px){ textarea { font-size: 16px; } } Apple devices zoom into fields on focus until the text is displayed on the…
-
1
votes2
answers972
viewsA: How to change the data type in $.post request in jQuery?
With the method $.post(url, data, success, dataType), you send the parameters like this: $.post('processamento/busca.php', { unidade: $("#unidade").val() }, function (response) {…
-
4
votes3
answers114
viewsA: "content: attr" does not validate in W3C
The validator error is precisely with the attribute db, but there is no error in this code CSS. The caveat is precisely in the attributes db and abbr. The attribute db does not exist, and for these…
-
1
votes2
answers2726
views -
0
votes2
answers202
viewsA: Sass does not rewrite files with prefix
Like the SASS interprets files with '_' as partial, just rename the file to a "common" name that will all be compiled accordingly. But attention: usually Frameworks and libraries make use of…
-
0
votes2
answers148
viewsA: best way to do sprites in SASS
There is the grunt-spritesmith if you use Grunt to compile your SASS. The good thing about this Grunt task is that it generates a SASS file with reference to all "pieces" of Prite, providing…
-
1
votes2
answers1919
viewsA: Google Maps with multiple markers coming from the database
Assuming you provide all the coordinates to the map through a JSON object, this would be: At the end of the function generateMap() $.ajax({ url:…
-
0
votes5
answers5323
viewsA: How to center a div with position:Fixed?
A modern and Javascript-exempt alternative is as follows: .container .fixo{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }…
-
3
votes2
answers390
viewsA: Tag <picture> does not work on mobile phones and IE11
The element <picture> is not supported in Safari for iOS and IE11. It is possible to verify this in http://caniuse.com/#feat=picture. An alternative is the use of attributes srcset and sizes,…
-
1
votes2
answers677
viewsA: Center vertically DIV without fixed height in CSS
A good alternative is: section{ position: relative; width: 100%; height: 100%; } article > div{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } (for easy reading, do…