css3 - CSS animation moving and changing color -


i not familiar css animations. client want achieve the following result when hovering contact button:

so clear:

  1. the square's move left right , vice versa
  2. when square moves, line underneath changes color

the top image start state, middle during effect (50%) , bottom image end stage.

is achievable css or need js well? how approach this?

i created quick , dirty jsfiddle here: https://jsfiddle.net/x0b397pb/

as can see, possible css. in example used pseudo elements (::before , ::after) create of elements.

you mentioned "im not familiar css animations". for used transitions.

transition: left 1000ms, right 1000ms, box-shadow 1000ms; 

each comma separated element value transition between 2 points. transition happens on change of div, can on hover, when applying div (through js).

to created effect of lines gradually shifting in color used element slides on top of original 2 lines. new lines have 0 width, on hover gain 100% width. transition transition: width 1000ms; happens gradually.

try not use code final example, ugly. hope gets point across.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -