JQuery does not set the attributes onmouseover and onmouseout in google chrome?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
5 views
On the onload event hang up function which reduces the large image on the page.


If you hover your mouse cursor over the picture should become of original size. If you do so

$(this).attr({ width: width_resized, onmouseover: '$(this).attr("width", ' + width + ');', onmouseout: '$(this).attr("width", ' + width_resized + ');' });


in Fox and Opera works fine, but in chrome is only set width.

$(this).attr("onmouseover", '$(this).attr("width", ' + width + ');');


So, too, does not work.


In what may be the problem?
by | 5 views

2 Answers

0 like 0 dislike
The problem is that you have custom jQuery for the API that it could not support.
\r
To do this:
\r
$(this) .width(width_resized) .mouseover(function () { $(this).width(width); }) .mouseout(function() { $(this).width(width_resized); }); 
by
0 like 0 dislike
The fact that you set the attribute, and hence not working correctly in different browsers.
Here in this article is the answer DOM: properties VS attributes.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
5 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
22,633 users