jquery - How do I remove opacity (hover opacity) when clicked so video will not be transparent -


i want able hover on youtube video , affect transparency/opacity (as now) but, when click play video, turns solid , no longer uses hover opacity.

i'm not sure how use jquery , click function on iframe. doesn't seem work.

* {    margin: 0px 0 0 0;  }  body {    background: url("https://photos-4.dropbox.com/t/2/aaazaqaql59efvsi-nmxk-jzk3dedldcqahbtj9zhmbz2g/12/20139880/jpeg/32x32/1/_/1/2/back.jpg/ej6giw8y9dugbygh/bwjw1osyltn5scruols8x1brd_phrj_y11ss9ctvrzq?size_mode=5") fixed;    background-size: cover;  }  #content {    width: 853px;    height: 480px;    background: #000000;    opacity: 0.8;    margin-top: 40px;    margin-left: auto;    margin-right: auto;  }  iframe {    opacity: 0.7;    filter: alpha(opacity=70);    -moz-transition: 0.4s ease-out;    /* ff4+ */    -o-transition: 0.4s ease-out;    /* opera 10.5+ */    -webkit-transition: 0.4s ease-out;    /* saf3.2+, chrome */    -ms-transition: 0.4s ease-out;    /* ie10? */    transition: 0.4s ease-out;  }  iframe:hover {    opacity: 1.0;    filter: alpha(opacity=100);    -moz-transition: 0.4s ease-out;    /* ff4+ */    -o-transition: 0.4s ease-out;    /* opera 10.5+ */    -webkit-transition: 0.4s ease-out;    /* saf3.2+, chrome */    -ms-transition: 0.4s ease-out;    /* ie10? */    transition: 0.4s ease-out;  }  #logo {    margin-top: 30px;    margin-left: auto;    margin-right: auto;    opacity: 0.6;    width: 600px;    height: auto;  }  #logo img {    width: 600px;    height: auto;  }
<div id="logo">    <img src="http://s277461962.websitehome.co.uk/codepen/logo.png" />  </div>  <div id="content">    <iframe width="853" height="480" src="https://www.youtube.com/embed/grscrqay2ci?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>  </div>

codepen: http://codepen.io/middi/pen/pgbngg

adding , removing classes bet here...

try this:

iframe.hoverclass {     opacity: 1.0;     filter: alpha(opacity=100);     -moz-transition: 0.4s ease-out;     // etc. }   $("iframe").mouseenter(function () {     $(this).addclass("hoverclass"); }).click(function () {     $(this).removeclass("hoverclass"); }).mouseleave(function () {     $(this).addclass("hoverclass"); }); 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -