Posts by tomasantunes • 1,579 points
123 posts
-
0
votes2
answers609
viewsA: Change bgcolor according to class
The event slid.bs.carousel occurs after the slide is active. $('#banner').on('slid.bs.carousel', function (ev) { mudaBG(); });
-
0
votes1
answer45
viewsA: How to duplicate a triangle randomly within the canvas?
let canvas; let ctx; let dx = 10; let dy = 10; let WIDTH, HEIGHT = 500; function setUp(){ canvas = document.getElementById("myCanvas"); ctx = canvas.getContext("2d"); let resetbtt =…
-
0
votes1
answer146
viewsA: Move Sprite to the mouse position with Phaser
there is this method: update() { this.player.x = game.input.x; this.player.y = game.input.y; }
-
1
votes1
answer29
viewsA: Mount a Strobe Light inside the JS canvas
You need to create an array of colors. let canvas; let ctx; function setUp(){ canvas = document.getElementById("myCanvas"); ctx = canvas.getContext("2d"); let showColour =…
-
0
votes2
answers2626
viewsA: Adjust image inside canvas
Increasing the resolution of the image should be avoided, so the image must be larger than the canvas. Then you need to check if the height is larger than the width to work with various image sizes.…
-
2
votes2
answers1130
viewsA: How to replace 1 bit of an integer without changing the other neighboring bits?
if we use XOR with 1 we can change a bit: 0 ^ 1 = 1 1 ^ 1 = 0 for example to change a 0 to a 4 we change the 3rd bit. char a = 0x00; int bit = 2; a ^= (1 << bit)…
-
1
votes1
answer443
viewsA: Help with placeholder that does not change color
it is necessary to change the opacity. And also missing the general case without prefixes. #menu li.search::input-placeholder { color: #fff; } #menu li.search input::-moz-placeholder { color: #fff;…
-
0
votes1
answer102
viewsA: Chartjs rotate text
canvas has both Translate() and Rotate() methods that can help in this situation: ctx.translate(xaxis.getPixelForValue(undefined, index) -16, yaxis.top + 5); ctx.rotate(-90*Math.PI/180);…
-
0
votes1
answer678
viewsA: Chart with Canvas
you need to fill an array with column values and draw the rectangles. <canvas id="canvas_grafico" width="500" height="500"> </canvas> // arquivo: grafico.js function Grafico(context, x,…
-
9
votes3
answers20457
viewsA: Round image mask with CSS
you can create an img inside a div with "overflow:Hidden;" .circle { background-color: #aaa; border-radius: 50%; width: 150px; height: 150px; overflow: hidden; position: relative; } .circle img {…
-
4
votes1
answer155
viewsQ: How to check duplicate files?
How can I check if two files are equal, even if the name is different in a js application?
-
1
votes1
answer41
viewsA: Javascript generated link does not work
animation is usually better with the requestAnimationFrame method(): var menuPosicaoAtual = 0; var menuPosicaoFinal = 200; var menuSairPosicaoInicial = 200; var menuIsOpen = false; function…
javascript-eventsanswered tomasantunes 1,579 -
2
votes2
answers3819
viewsA: How to create "Banner" with css?
with css it is possible to define different orders to create triangular shapes. <div class="banner">Texto</div> .banner { position: relative; margin-left: 25px; padding: 0 25px;…
-
1
votes2
answers234
viewsA: Positioning of div with jquery
you can apply a css Transform to compensate for the variable width. html: <div class="div1"> <div class="masterTooltip w100" data-label="erro">MOUSE</div> </div> <div…
-
0
votes1
answer105
viewsA: I can’t get the phone number out of a phone book
you need to loop because a contact can have several numbers. Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null); while (cursor.moveToNext()) {…
-
4
votes4
answers6187
viewsA: How to pick up element above Jquery?
the Prev() method returns the previous widget. $('#test-task').on('click', function(){ var element = $(this).parent().prev(); var idTask = $(element).text(); alert(idTask); });…
-
0
votes1
answer690
viewsA: Adjust Portrait Image to CSS Landscape
using only CSS can center and crop an image as follows: .thumbnail { background-position: center; background-size: cover; } <div class="thumbnail" style="background-image:…
-
2
votes1
answer162
viewsA: How to show audio preview while playing?
using analyserNode and canvas can do so: var w = 800; var h = 600; var total_bars = 16; var sampleSize = 2048; var background_color = "#231f20"; var bars_color = "#f0ad00"; var gap = 5; var…
-
2
votes1
answer1158
viewsA: Table with different size?
just remove this line: /* .post-body table td {width:20%;} */ and give a width to the desired first row cell: <tr> <th>Características</th> <th style="width:…
-
1
votes1
answer143
viewsA: How do I stop when an option is disabled in select, jquery detects that action (deselect)?
with select multiple the value saved is an array with the selected values. With each change you can check whether the unique value exists or not. $(document).ready(function() { var unique = "1";…
-
2
votes1
answer61
viewsA: "Mask-image" property does not work in Firefox. Is there an alternative solution?
with PNG gives to use canvas and works in firefox. <canvas id="my_canvas" width="500" height="313"></canvas> <script> var canvas = document.getElementById("my_canvas"); var context…
-
0
votes1
answer40
viewsA: Where to place canvas Rotate in this code
perhaps so: crop_canvas = document.createElement('canvas'); crop_canvas.width = width; crop_canvas.height = height; crop_canvas.getContext('2d').rotate(grausAtual * Math.PI / 180);…
-
1
votes1
answer145
viewsA: Canvas - draw repeated image
The canvas API has a feature for patterns. An example: var canvas = document.getElementById("my_canvas"), context = canvas.getContext("2d"), var img = new Image(); img.src = 'http://bit.ly/2fDRYfC';…