How to change the transparency of an img using jquery or javascript -


i beginning dabble in jquery , javascript , looking advice please. have below, following code makes video transparent when click on image. however, code need make image transparent too, upon click?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> <script>      $("#minecraftvideo").animate({                 opacity: '0.0'             });      $(document).ready(function () {         $("#picture_on").click(function () {             $("#minecraftvideo").animate({                 opacity: '1.0'             });         });     });  </script> 

the image has id="picture_on"

many thanks

you can use this selector. select element click on (the image).

<script> $(document).ready(function () {     $("#picture_on").click(function () {         $("#minecraftvideo").animate({             opacity: '1.0'         });         $(this).animate({opacity: '0'});     }); });  </script> 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -