javascript - CSS - Using hover to affect multiple elements differently -


i'm looking create akin mac app dock. basically, have number of divs next each other same class, , unique id (done through php).

currently, when hover on 1 element, magnifies using transform, doesn't affect elements adjacent them.

i'm wondering if there's way make item-2 has hover effect of transform:scale(2.0), , upon hovering on element, item-1 & item-3 effect of transform:scale(1.5);

although, imagine impossible in css. if so, there way can achieve effect in php or javascript somehow?

this tricky since transform: scale doesn't seem behave consistently across browsers.

i put css , javascript described, although making on browsers take more time.

try out demo here: codepen

html

<ul id="list">   <li><a href="#">one</a></li>   <li><a href="#">two</a></li>   <li><a href="#">three</a></li>   <li><a href="#">four</a></li>   <li><a href="#">five</a></li>   <li><a href="#">six</a></li> </ul> 

css

#list li:hover {   zoom: 2;   -webkit-transform: scale(2);   -moz-transform:    scale(2);   -ms-transform:     scale(2);   -o-transform:      scale(2);   transform:         scale(2);   position: relative;   z-index: 999;  } .beside {    zoom: 1.5;   -webkit-transform: scale(1.5);   -moz-transform:    scale(1.5);   -ms-transform:     scale(1.5);   -o-transform:      scale(1.5);   transform:         scale(1.5);  } 

javascript (jquery)

  $('#list li').on("mouseenter", function() {     $(this).prev().addclass("beside");     $(this).next().addclass("beside");   });   $('#list li').on("mouseleave", function() {     $(this).prev().removeclass("beside");     $(this).next().removeclass("beside");   }); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -