Posts by Samir Braga • 10,016 points
275 posts
-
2
votes1
answer274
viewsA: Problems identifying mobile screen with css
You have to enter the tag meta name="viewport" <meta name="viewport" content="width=device-width, initial-scale=1"> She is responsible for, among other things, resizing the viewport layout. In…
cssanswered Samir Braga 10,016 -
1
votes1
answer56
viewsA: Add values in DIV
Footsteps: Go through each input and add your value in a array, if it is not empty Join each item of the array with one ", "; Write the result in the div Put everything in one function and run it…
javascriptanswered Samir Braga 10,016 -
1
votes2
answers685
viewsA: Detect Shift key is pressed
Focusing more on the execution part of the function while pressed: Without a Interval var count = 0; var mainFunction = function(){ console.log(++count); } $(document).keydown(function(e){…
javascriptanswered Samir Braga 10,016 -
2
votes1
answer26
viewsA: script only in visible tags
Use the selector :visible: $( ".rodapeUlCat li:visible" ).length In the case of occult, there is the :hidden DEMO $(".rodapeUlCat").append($("<li>")); var n = $(".rodapeUlCat…
-
2
votes1
answer10202
viewsA: How to put a link in a background-image?
Option 1 Put a border-radius on the link: a{ border-radius: 50% } Note: The dotted area is the "clickable area" of anchovy DEMO a div { width: 120px; height: 120px; background: #09f; border-radius:…
-
2
votes1
answer1783
viewsA: Can I disable a div using css?
Just use it instead: #botao:hover #comentario { opacity: 1; } That: #botao a:hover + #comentario { opacity: 1; } So the Hover will be on link and not in the div, as a whole. Use the seletor + of…
-
4
votes3
answers809
viewsA: Opacity according to page scroll
I imagine you want something like this: The calculation of opacity is equivalent to: opacidade = valorInicial * (1 - scrollTop / 100vh) Being the 100vh represented by $(window).height(). Javascript:…
-
2
votes1
answer489
viewsA: How to fire a Rigger with jquery?
In order to use the trigger jquery you must previously assign a function to the particular event you want to fire, for example: At the event click of the button use a .preventDefault() and then use…
-
2
votes1
answer89
viewsA: How do I create a fullscrenn button for my video player?
For that there is the Fullscreen API. With her you can: Check that Fullscreen mode is enabled (fullscreenEnabled) Know if there is any element which in full screen and which is (nodeName)…
-
4
votes2
answers1648
viewsA: Javascript - How to input back to normal state after validation
You can do this in two ways: 1 - Check otherwise You use a if to check and display messages, use a else to hide her: var input = document.getElementById("nome"); function valida_form(){…
javascriptanswered Samir Braga 10,016 -
3
votes1
answer54
viewsQ: Check if text belongs to the widget and not to the child
For example, in the structure below I have a div that has a text and another div which also has a text. How can I capture or verify if a text is the direct son of a tag, and not the son of another…
-
1
votes1
answer682
viewsA: Limit elements when arriving in a div
I made a version of how it would work, in a very simple way (put in whole page): var DH = $(document).height(); $(window).on('resize', function() { DH = $(document).height(); })…
htmlanswered Samir Braga 10,016 -
1
votes1
answer932
viewsA: Remove a specific element with JAVASCRIPT from an HTML structure
If listaProcessos is the same as listaNumeros, you can do so: I created a function renderList() that recreates the array-based list listaNumeros and in its values. function renderList(){ // Deixa…
-
1
votes1
answer4234
viewsA: Stylization of Input Date
The aesthetic patterns of input date will depend on the browsers that support it. If you want a cross-browser and customizable option, you will have to use a plugin, or something like that. Here’s…
-
0
votes0
answers24
viewsQ: Problem with dynamic element creation
I am developing an application that uses a lot of Jquery, since there are several very specific functions. But for reasons of customization and optimization, I managed with the mix of some…
-
1
votes4
answers18339
viewsA: Javascript customize confirm, replace text button "ok" and "Cancel", run function only if clicked on ok
No, you won’t be able to change the text of the buttons confirm() native, what you can is create a dialog with some lib or create yourself. Take a look at this issue: Putting two Yes and No buttons…
javascriptanswered Samir Braga 10,016 -
2
votes1
answer57
viewsA: How to decide which and how to make the css structure of a responsive menu
I believe that this, as expected, will depend a lot on your site. His proposal, the design in general, the code, which frameworks use, among others. HTML & CSS (only) You can make a very simple,…
-
2
votes1
answer527
viewsA: Compile directives from the Controller
Well, I’ll leave an example with $compile really, take a look. Example with JSON and ngRepeat: var app = angular.module('app', ["ngAnimate","ui.bootstrap"]); app.directive('compile', function…
-
2
votes1
answer776
viewsA: Bank slips: Pick value correctly by the digitable line
You can do it like this: var linha = "34191.75009 01544.841545 78554.760005 4 25230000000883"; var valor = parseFloat(linha.substring(linha.length - 10, linha.length)).toString() // uso parseFloat…
javascriptanswered Samir Braga 10,016 -
4
votes1
answer325
viewsA: Is it a problem to insert another controller into Angularjs?
This is no exception to the Angularjs standards, in the Controllers documentation itself there is an example with this very clear: <div class="spicy"> <div…
-
3
votes1
answer3408
viewsA: How to do 'tremendous' effect with css
I imagine you wished for something like this: input:focus { animation: treme 0.1s; animation-iteration-count: 3; } @keyframes treme { 0% {margin-left: 0;} 25% {margin-left: 5px;} 50% {margin-left:…
cssanswered Samir Braga 10,016 -
1
votes2
answers1286
viewsA: How to get the value of an attribute in Jquery?
To make the effect disappear/appear you can use the .toggle() jquery: $(document).ready(function() { $("ul#lista").css('display', 'none'); $("img#imagem").click(function() { $("#lista").toggle(); })…
-
3
votes1
answer1574
viewsA: Flap system with jQuery
Just a suggestion, when I make flap system use the same structure you use, but I create the li dynamically navigational. So you don’t even need to add them, just go through the div.tab-content:…
-
1
votes3
answers57
viewsA: THIS object in conflict between jQuery and ECMA6 class
You could call your own class Teste(), and for the selection of this inside the loop could use $(this): class Teste { metodoUm() { $('input').each(function() { teste.metodoDois($(this)); }); }…
-
1
votes1
answer1620
viewsA: How to filter html text and display div according to the found text
What you want can be done with .hide() and .show(), allied with the selection of div in which the p is with the .parent(): $("#textFind").keyup(function(){ var stringPesquisa = $(this).val();…
-
3
votes2
answers3964
viewsA: Angular edit the values of an object without changing the "original"
You can do it like this: Use the angular.copy() within the function edit which returns only a copy of the object, and a second argument in this which would be the index of the users array…
angularjsanswered Samir Braga 10,016 -
1
votes1
answer256
viewsA: Left alignment with element collision detection
As I really had difficulty manipulating your code, I made another option, which, although I haven’t had time to test many possible positions, I think is working right and meeting what you asked:…
-
2
votes3
answers649
viewsA: Limit characters in div with contenteditable
Here’s a suggestion for style, I’ll leave the final result here at the beginning: var span = document.getElementsByTagName('span')[0]; function getCaretPosition(element) { var caretOffset = 0; if…
-
1
votes2
answers522
viewsA: The script loads before ng-view has loaded (Angularjs)
After specifying your controller in the $routeProvider, use the controller to load scripts. In this case, remove them from the body: app.controller('yourCtrl', function ($scope) { $scope.load =…
-
0
votes1
answer110
viewsA: How to show/display each <li> item?
If you have the same number as li and the same number of modals, and these are in exactly the same order, you could capture the .index() of li clicked and use it on .eq() of the modal to be…
-
1
votes1
answer43
viewsA: How to make array2 have the same ratio between indexes after array1 shuffle
See if that’s the way you wanted it: First I created an object in which the keys run to the first array and the respective values correspond to the second array: var corresp = {};…
-
1
votes1
answer160
viewsA: Conflict between focusout and click
Try using instead of "click", "mousedown": And something else instead of .parent().parent().parent(), can use .closest(), past the class (or id) of the element you want to limit the hierarchy…
jqueryanswered Samir Braga 10,016 -
0
votes2
answers530
viewsA: Jquery - Compare 2 arrays in each
If what’s inside the id of each data is an array, reason to use the $.each, can do so: $.each(data.id, function(i, item) { $(".lado").prepend("<div id='" + data.id + "'><select…
jqueryanswered Samir Braga 10,016 -
9
votes1
answer171
viewsA: Element Rotation With Arrow
You can use the property transform-origin, in the pseudo element :after, define it in the center of the parent element. See -ms-transform-origin: 11px 58px; -moz-transform-origin: 11px 58px;…
-
0
votes1
answer127
viewsQ: Otherwise with redirectTo to another url that is not part of the Single page application
For example, on the routes below: app.config(function($routeProvider){ $routeProvider.when('/dashboard', { templateUrl: "../views/dashboard.html", controller : "dashboardCtrl" }).when('/cadastro', {…
-
1
votes1
answer434
viewsA: Error with duplicate values in Angularjs
Altemberg, from what I can see, you’re using an object var grp = {}; that has an array grp[chr] = []. You created in the object grp, a key b that receives the category within an array, would result…
-
0
votes1
answer160
viewsA: Jquery - append in prepend generated element in each
You could do it like this: $.each(data.id, function(i, item) { var tes = $("<div id='tes'>" + data.id + "</div>");// guarda o novo elemento dentro de uma var $(".lado").prepend(tes); //…
jqueryanswered Samir Braga 10,016 -
2
votes1
answer47
viewsA: Filter Element Option
Use: $('#list_nome option') // Captura os dois options dentro do #list_nome If you want to capture what you possess value same as the text box is doing right, but use only one attribute per square…
-
4
votes2
answers455
viewsA: Font Responsiva
This happens because the em will take, in this case, a percentage of the source size of the parent element, and not necessarily its own size (height/width), so if in mobile you don’t use a…
-
4
votes1
answer101
viewsA: Does anyone know how to assign an edge to a triangle made with css?
You can make a triangle within another: .triangle { position: relative; width: 0; height: 0; border-style: solid; border-width: 0 44px 34px 44px; border-color: transparent transparent #007bff…
cssanswered Samir Braga 10,016 -
5
votes2
answers617
viewsA: How to identify a number (in full) in a sentence
Thiago, what I got was a Python function passed to javascript, as you can see in that question. But it’s quite functional: var Small = { 'zero': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five':…
-
1
votes1
answer42
viewsA: button doesn’t seem to be in the DOM
Your button is being created dynamically. Usually when we want to find this type of element in the DOM, we use this: $(document).on('click', '#show', function(){ alert('oi'); }) Example assigning…
-
1
votes1
answer343
viewsA: Highlight mouse click position with DIV overlay
I wish I had something like this? function ShowOverlay(divID) { var divObject = document.getElementById(divID); var divOverlay = document.getElementById('div1'); divObject.addEventListener('click',…
-
2
votes2
answers215
viewsA: Insert a dot in the penultimate variable item
Try this, I created a function insertDot(), which takes as argument the number you want: var a = 14013; function insertDot(a){ a = a.toString(); // Transforma em String var beforeDot =…
-
3
votes1
answer76
viewsQ: Performance in applications with multiple loops
While searching a little, I found several codes in Java to calculate the determinant of an array. I passed one of them to javascript and it was like this: function determinant(A, N) { var det = 0;…
-
2
votes1
answer250
viewsQ: Send data to client without using an additional url
Hello. What I want to know is the best way to send data to the client and this data will be received through a function (which can be executed in a click). In the example below I will render a page…
-
2
votes0
answers51
viewsQ: Do searchers interpret the elements before or after rendered by Javascript?
For example, in a ng-repeatangular or in single append of Jquery, searchers will read all elements created dynamically, since it is a replace client-side? In the section below, taking the example of…
-
2
votes3
answers2476
viewsA: How to list json by separating key and value correctly
You can just do it like this: function print(meuArray) { for (item in meuArray){ $("#parag").append(item + " " + meuArray[item] + "<br />"); }; }; You don’t own a array and yes a object. So…
-
2
votes1
answer246
viewsA: Hide submenu by clicking another
Thiago try to implement this code: $j(".abre-dropdown a").click(function() { var item = $(this).parent(); $(this).closest('ul').find('ul').not($(this).parent('li').children('ul')).slideUp();…
-
2
votes1
answer252
viewsA: Save state after binding html elements
Well, I don’t know if it’s best practice, but I thought I’d try and get a hit. I made an example with the rescue in localStorage. Among the data saved are: Position x and y of .panel; Position x and…