Friday 15 August 2014

html - Using jquery .hover, with $this -



html - Using jquery .hover, with $this -

this 1 of html elements.

<textarea type="text" data-class-changer="question" class="questioninputcss js-questioninput" data-integer-question="878"></textarea>

when hover on element, want element toggleclass

i tried addclass , removeclass, i'm not sure if have been animated - need. in case, none of scripts have worked.

this mouseover script, works , identical first hover script doesn't work.

$(document).on("mouseover", ".questioninputcss",function() { $(this).toggleclass("questioninputcsshidden", 700); });

these many hover scripts i've tried:

$(document).on("hover", ".questioninputcss",function() { $(this).toggleclass("questioninputcsshidden", 700); }); $(document).hover( function(){ $(this).addclass('questioninputcsshidden') }, function(){ $(this).removeclass('questioninputcsshidden') } ); $(".js-questioninput").hover( function(){ $(this).addclass('questioninputcsshidden') }, function(){ $(this).removeclass('questioninputcsshidden') } ); $(".js-questioninput").hover(function(){ $(this).toggleclass("questioninputcsshidden", 700); }); $(".questioninputcss").hover(function(){ $(this).toggleclass("questioninputcsshidden", 700); }); $(document).hover(function(){ $(this).toggleclass("questioninputcsshidden", 700); }); $(document).hover(function(){ $(this).toggleclass("questioninputcsshidden", 700); }, function(){ $(this).toggleclass("questioninputcsshidden", 700); });

by described, have is:

.questioninputcss:hover { //your desired hover styles in here (the styles have on answerinputcsshidden) }

and add together transition base of operations element if want animated per request

.questioninputcss { transition: 1s all;

based on fiddle here working illustration of - http://jsfiddle.net/alexjm/kphq9ap2/9/

if want utilize this, don't hover() jquery method, fighting against each other. if want utilize hover, if read documentation - problem having hover binds both when mouse enters , leaves targeted item - see here reference http://api.jquery.com/hover/.

so, -

$( ".questioninputcss" ).hover( function() { $( ).addclass("questioninputcsshidden", 700); }, function() { $( ).removeclass("questioninputcsshidden", 700); } );

see here - http://jsfiddle.net/alexjm/kphq9ap2/31/

jquery html

No comments:

Post a Comment