JavaScript

Member

jerald_rippin

Nice Module Export Function in Javascript ๐Ÿ˜€

1
2
3
module.exports = function(settings, done) {
ย  ย  return '3912';
};


Member

vivien_maggio

When you are really love setTimeout in Javascript

1
2
3
4
5
setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 50);
setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 100);
setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 150);
setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 200);
setTimeout("__zoomed_div_style__.left = parseInt(__zoomed_div_style__.left) - " + (diff_width * 0.1) + " + 'px'", 250);


Member

letha

by letha , in category: JavaScript , 25 days ago
no answers

List of Constants in Javascript

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Variables of elements and inputs to manipulate
const dmContainer = document.querySelector('#dmContainer');
const nameMotor = document.querySelector('#nameMotor');
const chasisBtn = document.querySelector('#chasis-btn');
const chasisModal = document.querySelector('#chasis-modal');
const chasisType = document.querySelector('#chasisType');
const colorChasis = document.querySelector('#color-chasis');
const modalPop = document.querySelector('.modalPop');
const inputName = document.querySelector('#inputName');
const motorsName = document.querySelector('.motorsName');
const behindImg = document.querySelector('.defMotor');
const tyresBtn =document.querySelector('#tyres-btn');
const tyresModal = document.querySelector('#tyres-modal');
const tyresType = document.querySelector('#tyres-type');
const handleBtn = document.querySelector('#handle-btn');
const handleModal = document.querySelector('#handle-modal');
const handleType = document.querySelector('#handle-type');
const headBtn = document.querySelector('#head-btn');
const headModal = document.querySelector('#head-modal');
const headType = document.querySelector('#head-type');
const mufflerBtn = document.querySelector('#muffler-btn');
const mufflerModal = document.querySelector('#muffler-modal');
const mufflerType = document.querySelector('#muffler-type');
const brakeBtn = document.querySelector('#brake-btn');
const brakeModal = document.querySelector('#brake-modal');
const brakeType = document.querySelector('#brake-type');
const frontFlash = document.querySelector('.flash-chasis-f');
const rearFlash = document.querySelector('.flash-chasis-r');
const flashSelect = document.querySelector('#flashSelect');
const doneChasisย  = document.querySelector('#doneChasis');
const motorsName2 = document.querySelector('#motors-name');
const motorsName3 = document.querySelector('#motors-name1');
const colorHead =document.querySelector('#color-head');
const colorMuffler = document.querySelector('#color-muffler')


Member

vivien_maggio

You will never speak in Javascript language ๐Ÿ˜ƒ

1
2
3
4
5
6
7
console.log(parseInt(0.5)); // 0
console.log(parseInt(0.05)); // 0
console.log(parseInt(0.005)); // 0
console.log(parseInt(0.0005)); // 0
console.log(parseInt(0.00005)); // 0
console.log(parseInt(0.000005)); // 0
console.log(parseInt(0.0000005)); // 5


Member

makayla.beahan

Initialize multiple times instead of using comma in jQuery

1
2
3
4
5
6
7
8
9
$(document).ready(function () {
	$("a").easyTooltip()
});
$(document).ready(function () {
	$("img").easyTooltip()
});
$(document).ready(function () {
	$("span").easyTooltip()
});


Member

mark.berge

When one setTimeout in Javascript is not enough ๐Ÿ˜

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
setTimeout(()=>{

  $('.arrowDashed, .OG1ficon, .OG1LeaderLeft, .OG1LeaderRight').css({'transition':'1s', 'opacity':'1'});
  map.opacity.inside([1,0,0], 1);

  setTimeout(()=>{
    map.animate.og1Results(50, 2);
    $('#anotherIdToCall6').css({'transition':'1s', 'opacity':'1'})

    setTimeout(()=>{
      map.opacity.main([1,1,0], 1)
      $('.IGTopContestWrap').css({'transition':'0s', 'opacity':'0'});
      $('.IGBottomContestWrap').css({'transition':'0s', 'opacity':'0'});
    },650)

  }, 1250)

}, 100)


Member

letha

I think too many parentNode in JavaScript ๐Ÿ˜

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
for(var i=obj.parentNode.parentNode.childNodes.length;i>=0;i--)
{
  if(obj.parentNode.parentNode.childNodes[i]!=undefined)
  {
    if(obj.parentNode.parentNode.childNodes[i].tagName=="TR")
    {
      if (obj.parentNode.parentNode.childNodes[i].childNodes[0]!=undefined){
        for (var j=obj.parentNode.parentNode.childNodes[i].childNodes.length;j>=0;j--)
        {
          if(obj.parentNode.parentNode.childNodes[i].childNodes[j]!=undefined){
            if(obj.parentNode.parentNode.childNodes[i].childNodes[j].childNodes[0].tagName=="TABLE"){
              obj.parentNode.parentNode.childNodes[i].childNodes[j].childNodes[0].childNodes[0].childNodes[0].childNodes[0].attributes.getNamedItem("background").value = "images/category_n.png";
            }
          }
        }
      }
    }
  }
}


Member

letha

by letha , in category: JavaScript , a month ago
no answers

Check hash function in Javascript

1
2
3
4
5
6
7
function checkHash(){
    if(getCookie("needHash") != null){
        if(getCookie("needHash").length>0){
            ensureHash(getCookie("needHash"));
        }
    }
}


Member

mark.berge

by mark.berge , in category: JavaScript , a month ago
no answers

Preload images in Javascript ๐Ÿ˜

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
function newImage(arg) {
    if (document.images) {
        rslt = new Image();
        rslt.src = arg;
        return rslt;
    }
}

function preloadImages() {
          newImage("bigphoto/kran.jpg");
          newImage("bigphoto/z1.jpg");
          newImage("bigphoto/z2.jpg");
          newImage("bigphoto/truba.jpg");
          newImage("bigphoto/put.jpg");
}


Member

mark.berge

by mark.berge , in category: JavaScript , a month ago
no answers

Javascript code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
if((value == '284') && (jQuery('#elt_31').val() != 0))
{
       setTimeout(function(){jQuery('#elt_31_fake span[name="287"]').mousedown();},500);
}
if((value == '285') && (jQuery('#elt_31').val() != 0))
{
       setTimeout(function(){jQuery('#elt_31_fake span[name="288"]').mousedown();},500);
}     
if((value == '286') && (jQuery('#elt_31').val() != 0))
{
       setTimeout(function(){jQuery('#elt_31_fake span[name="289"]').mousedown();},500);
}