Posts by Kazzkiq • 11,493 points
136 posts
-
14
votes2
answers161
viewsA: Height property of jQuery and Javascript, what’s the difference?
The two functions deal with different aspects: screen.height = height based on monitor resolution $(window).height() = height of window browser The object screen Javascript forwards the resolution…
-
2
votes1
answer154
viewsA: Two elements with same height with jQuery - all the time
You can use the jQuery function .resize(): $(window).resize(function(){ $(".gallery-description").height( $(".gallery-thumbs li a img").height()); }); Example: FIDDLE What this function does is…
-
3
votes5
answers5370
viewsA: How to apply ! CSS import via jQuery?
You can use the function .attr() jQuery: $('.prodMenor:eq(6)').attr('style','margin-right: 0 !important'); Example: FIDDLE…
-
2
votes2
answers99
viewsA: Menu in lower tab form
You can make this button functionality directly in CSS: /* Div dentro da sua <td>, contendo os botões */ .embrulho{ position:relative; overflow:hidden; } tr:hover .embrulho{ overflow:visible;…
javascriptanswered Kazzkiq 11,493 -
30
votes1
answer46121
viewsQ: What is a DTO?
I’ve been dealing with Java for a little while and I always hear the expression DTO related to pulling something from a bank, but I never really understood what it is. Is it just a name to reference…
-
3
votes2
answers340
viewsA: Apply jQuery effect to the current HTML element?
I believe that for this problem only CSS already solve everything: .detalhesArticleHome .overlayContent{ opacity:0.5; } .detalhesArticleHome:hover .overlayContent{ opacity:0; } What the above code…
-
7
votes2
answers3994
viewsQ: How to calculate total table value with Javascript?
Imagine that I have a table with a number of rows that varies dynamically (that is, the user can insert more rows) and each row has two columns with two text fields: quantidade and valor. What would…
-
4
votes3
answers9349
viewsA: Disable all inputs from a form using css only?
Unable to block access to inputs with CSS only. What you can do is simulate this lock, so that the user understands that the input should not be used, example: form.disabled input{…
-
1
votes1
answer65
viewsA: touchEnter/touchLeave do not work
Touch events have a somewhat different naming pattern than mouse events, mainly due to the operating difference between both types of events. For example, with a mouse, you can hover over an element…
-
17
votes1
answer85227
viewsQ: Javascript generating float with multiple decimals
When creating an order calculation system (quantity x value) I realized that in some cases when adding broken values Javascript returns numbers with many other decimal places more than expected.…
-
1
votes4
answers549
viewsA: Element does not take the parent background
To replicate the white background for all children of the element, you can do so: .intro-lang *{ background:white; } To replicate for titles only h1: .intro-lang h1{ background:white; }…
-
2
votes1
answer950
viewsQ: Return total of each order with Mysql?
Imagine I have a table pedidos with the following fields: And that I have two other tables (pedido_a, pedido_b) of two different types of applications as the examples below: Each item in the table…
-
5
votes1
answer9979
viewsQ: Create a "accordion" menu with CSS only?
Menus in style accordion (accordion) are useful for saving space, since you only open the parts with the content you need. Example of style menu accordion. But all of these menus usually use…
-
9
votes1
answer9979
viewsA: Create a "accordion" menu with CSS only?
"It is possible to create this type of functionality only with CSS?" Yes. You can achieve this effect with CSS using the HTML attribute tabindex. HTML: <ul class="menu-sanfona"> <li…
-
5
votes3
answers11791
viewsA: Overwrite a <button> to a <img>
My solution consists of a bit of CSS3 and the addition of a class in HTML: <div class="thumbnail-wrapper"> <img src="imagems/imagem1.png" /> <button></button> </div>…
-
8
votes2
answers1227
viewsA: <div> that works like a <textarea> does not break line when it is sent
The problem is that you are using the function .text() jQuery to send the comment. This function, unlike the .html(), takes only the text of the element you have defined, and delete any HTML tags…
-
28
votes7
answers33990
viewsQ: How do SELECT all fields except a few?
It is known (and has been asked) which should be avoided SELECT * in some cases in bank queries. But let’s imagine that I have a table with 50 columns, and I want to select 40 of them. Just the fact…
-
5
votes3
answers1376
viewsQ: How to return most common words from a text with PHP?
I would like to know how best to return the most frequent occurrences of substrings in a string containing text. Example: $texto = "Hoje nós vamos falar de PHP. PHP é uma linguagem criada no ano de…
-
2
votes2
answers1980
viewsA: Blur effect on different browsers
"(...) The proposal is to use CSS properties to do so. (...)" If it’s only with CSS yet nay it is possible to create a cross-browser solution. But with a hint of SVG you can get very close. Here’s…
-
0
votes4
answers868
viewsA: How to make Empty() accept the value 0?
Another form of solution would be: else if (empty($idade) || count(ltrim($idade," ")) < 1) What this check does is: Checks whether the variable $idade is empty; Or if its length is less than 1…
-
4
votes2
answers252
viewsA: How to make <script></script> not appear in the HTML file. Only the text appears inside Document.write
Using jQuery, you could do the following: function removeScripts(el) { //Para cada elemento que deve ter o script removido $(el).each(function () { var i = this; //remove os espaços em branco var…
-
2
votes3
answers10283
viewsA: Rename image name uploaded
On the line $imagem = $_FILES['imagemupload']['name']; Subistitua by: $extensao = pathinfo($_FILES['imagemupload']['name']); $extensao = ".".$extensao['extension']; $imagem =…
-
7
votes2
answers5374
viewsQ: How and when to use exceptions in PHP?
In PHP, most native functions return a boolean false, whole 0 or NULL if some type of inconsistency is found in the value passed to it. Example: $exemplo1 = explode("","tente me explodir"); // false…
-
2
votes2
answers860
viewsA: Last position of a string
You could use the function .slice() Javascript, then your code would look like this: var elements = document.querySelectorAll('body *'); for (var i = 0; i < elements.length; i++){ var txt =…
-
24
votes5
answers22797
viewsA: How to invert dates in PHP, regardless of format?
Version with explode(): function inverteData($data){ if(count(explode("/",$data)) > 1){ return implode("-",array_reverse(explode("/",$data))); }elseif(count(explode("-",$data)) > 1){ return…
-
14
votes1
answer1965
viewsQ: How does the HTML5 <template> element work?
Recently I saw some news about a new HTML element called <template> specified by W3C and which has already been implemented in most modern browsers. Apparently it allows the creation of custom…
-
2
votes2
answers361
viewsA: Return div to initial position after animation?
The jQuery property .animate() does nothing more than create an attribute style in its HTML element and change its value gradually. So, if you remove this attribute after animation, the element…
-
3
votes2
answers351
viewsQ: How to find the installation location of a package via SSH?
I installed a package as in the example below: $ apt-get install nome-pacote But I can’t find which directory it was installed in. Is there a command to find out where the package is? Remembering…
-
2
votes2
answers202
viewsA: Doubts and More Doubts about the bootstrap 3 Layout
The HTML structure would look like this: <div class="row"> <div class="col-md-12"></div> </div> <div class="row"> <div class="col-md-12"></div> </div>…
-
6
votes1
answer99
viewsA: How to create a "Glass pane" in Javascript?
This can be done via CSS: #glasspane{ pointer-events:none; } This property disables any mouse event in the element in question, which causes the element just below where you clicked to receive the…
-
1
votes1
answer6245
viewsA: How to use bootstrap for font sizes?
Like you said, the measure em is a relative measure, i.e., it is calculated from a fixed value "base". Thus, you could make the following code: /* Portrait tablet to landscape and desktop */ @media…
-
1
votes5
answers1182
viewsA: HTML element does not become visible
CSS respects the law of superscription, that is, what comes last is that it has priority. So the solution would be to reverse the order of the classes: .nome_erro { display: none; } .nome_erro.erro…
-
1
votes2
answers1336
viewsA: Loading with Ajax
You could start the loading at the time when the function Open() was fired, and close it as soon as the AJAX response returned. Example: function Open(url){ //Chama o loader loaderInit(); //Faz a…
-
11
votes5
answers2054
viewsA: Why put Javascript, CSS, and images on another server?
There are several ways to implement this type of solution, the most common currently (and which you are probably referring to) is called CDN (Content Delivery Network). Although it is being widely…
-
1
votes1
answer352
viewsQ: How to make a function return result only after click?
When using the function confirm() in Javascript, it’s usually like this: var resultado = confirm("Deseja realmente confirmar?"); if(resultado){ //confirmou... } I wonder if there is any way to do…
-
4
votes3
answers8001
viewsQ: What is the right way to remove the edge with CSS?
To remove edges in CSS I usually use one of the two values: .exemplo{ border:0; /* ou */ border:none; } The funny thing is that they both work, and it happens with other properties like outline, but…
-
0
votes2
answers97
viewsA: Small font - Phonegap
In your case it seems that the problem is because of the viewport, and not the source itself. Adding this metatag should solve: <meta name="viewport" content="width=device-width,…
-
10
votes4
answers47612
views -
0
votes2
answers504
views -
5
votes1
answer338
viewsQ: How to check the existence of multiple values in a string with Javascript?
To find only a fixed value in a string I can use the Javascript function indexOf(), example: var string = "Oberyn se vinga"; string.indexOf('vinga') >= 0 //retorna true ou false But how would I…
javascriptasked Kazzkiq 11,493 -
8
votes3
answers1709
viewsA: Color in css property not working in IOS Safari
This is most likely due to the fact that most mobile operating systems automatically identify phone numbers and create a link of them with the smartphone dialer in order to "facilitate" the life of…
-
3
votes3
answers988
views -
2
votes1
answer640
viewsQ: Is it possible to pick the color of a pixel on a gradient element?
Imagine I have an element div with the following CSS: .minha-div{ width:100px;height:100px; background:linear-grandient(45deg, orange, red); } It’s possible that when I hover over that div, it tells…
-
5
votes3
answers657
viewsA: Save current time to a file . txt
If what you are trying to do is generate a . txt the answer is: Yes, it is possible. HTML5 allows the use of the attribute download in tags <a> that does nothing more than force the contents…
javascriptanswered Kazzkiq 11,493 -
0
votes2
answers1215
viewsQ: Is it possible to assign Objectid() to subcollections in Mongodb?
Imagine the following Gospel: { _id:ObjectId("123456..."), user:"João", artigos:[ { id: new ObjectId(), titulo:"Lorem ispsum.", texto:"Lorem ipsum dolor sit amet..." } ] } In short: A user may have…
-
1
votes2
answers326
viewsA: Form does not commit because of jquery’s $("#div"). attr("disabled",true); command. What to do to resolve?
Put a setTimeout 1 millisecond in the action of locking the button: $('button').on('click',function(){ var btn = $(this); setTimeout(function(){ btn.attr('disabled',true); },1); //... }); This way…
-
3
votes2
answers163
viewsA: on() and bind() are not working
As I understand it, you want to disable the button while AJAX is running so the user can’t fire multiple requests, correct? In this case it could be done so: $("#meuBotao").on('click',function(){…
-
10
votes3
answers1415
viewsQ: When should I use elements '<ul>'?
Recently I was thinking about the structure of a component for a project in which we are trying to follow the outlines of the W3C semantics, but I ended up with a certain doubt. Here is the…
-
6
votes1
answer1345
viewsA: CSS responsive layout in columns
Recently I replied a question where the solution, in large part, can be applied here also. You can solve this problem as follows: .menu{ /* estilo atribuído ao elemento que contém o menu */…
-
4
votes3
answers977
viewsA: How to make Divs with same height and 100% height
You can play this functionality with a little CSS and Javascript. First the HTML: <!-- O nome das classes já explica o que cada elemento representa --> <div class="menu"></div>…