0

JS Odd Behavior - IMG Transition function

This function changes attribute values of an image, according to the context. It takes multiples params for a most accurate behavior, but it's doesn't matter. That checks wheter the value will to ascend or descend, then take the proper way. In test cases, the element is setting to descend, and you will notice that the desc() makes it easier, for then set the Attribute onmouseover/out (according to the context) with the same function but one addend, the boolean true in the last param, that changes the way when the other event occurs. Notice the statement if(max==false), which should be the way, but it`s not happens. Instead, the console displays some really odd: Uncaugh TypeError: grayscale is not defined - Line 2. Have nothing on line 2. "Grayscale" is the argument for the filtermethod parameter, so close to be. I`d like to know why. Thanks.

9th Feb 2021, 1:11 PM
Ivan Zanoth
Ivan Zanoth - avatar
4 Réponses
0
Hi ,most of what you said doesn't makes sense for me ,maybe try writing in your native language and then use google translate for the english version , anyway can you show the code ?
9th Feb 2021, 1:17 PM
Abhay
Abhay - avatar
0
The code is stored on my Code Bits. If you are not xen you can answer i'm sure.
9th Feb 2021, 1:27 PM
Ivan Zanoth
Ivan Zanoth - avatar
0
if you use setAttribute, you should provide a string. but strings you've provided isn't valid javascript: var str = 'text'; var bool = false; var num = 42; console.log(str+', '+bool+', '+num); will output: text, false, 42 while we are expecting: "text", false, 42 for basic values, you could use JSON.stringify to safely add quotes to string: var json = JSON.stringify; console.log(json(str)+', '+json(bool)+', '+json(num)); will output: "text", false, 42
9th Feb 2021, 4:24 PM
visph
visph - avatar
0
el.setAttribute('onmouseout', 'transition('+id+', null, '+flag+', true)');"?
14th Feb 2021, 12:49 AM
Ivan Zanoth
Ivan Zanoth - avatar