Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a fiddle with a solution. This involves using a separate absolutely positioned div with transparency.</p> <p><a href="http://jsfiddle.net/jessekinsman/xywKm/3/" rel="nofollow">http://jsfiddle.net/jessekinsman/xywKm/3/</a></p> <p>The HTML</p> <pre><code> &lt;div class="container"&gt; &lt;div class="background"&gt; &lt;/div&gt; &lt;input type="text" name="test" class="white" /&gt; &lt;/div&gt; </code></pre> <p>The CSS</p> <pre><code>* { box-sizing: border-box; -webkit-box-sizing: border-box; } .container { width: 200px; height: 50px; overflow: hidden; position: relative; } .background { position: absolute; left: 100%; background: red; width: 100%; height: 100%; -webkit-transition: left 300ms linear; transition: left 300ms linear; opacity: 0.5; -webkit-opacity: 0.5; z-index:0; } .background.view { left: 0; } .white { background-color: white; } .red { background-color: red; } input { background-color: transparent none; width: 100%; height: 100%; z-index: 100; } </code></pre> <p>jQuery just to add and remove the classes</p> <pre><code>$("input").focus(function(e){ $(".background").addClass("view"); }); $("input").focusout(function(e){ $(".background").removeClass("view"); }); </code></pre> <p>Probably the best option unless you have some specific styling on your input element that you don't want to loose. Then you should use a background image.</p> <p>Here is a link to that fiddle <a href="http://jsfiddle.net/jessekinsman/5aL4L/1/" rel="nofollow">http://jsfiddle.net/jessekinsman/5aL4L/1/</a></p> <p>Also wasn't sure if you wanted the animation to loop until some criteria is met. If that is the case, you should use the css transform option and have it loop until the criteria is met.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload