Using jQuery to change div width from 50% to 70% on hover

后端 未结 3 1425
我寻月下人不归
我寻月下人不归 2021-01-13 12:12

I have two divs that have 50% width each. I want to make it so that the the hovered div expands to 70% and the other reduces to 30%. And when the mouse moves out, they both

3条回答
  •  失恋的感觉
    2021-01-13 12:53

    This should work nicely for you:

    
    

    EDIT: Added animation
    EDIT: Added height resize to animation

    
    
    Hello world!

    EDIT: If you want it to fill the height of the window, just use window.innerHeight in place of the container height:

    
    
    Hello world!

    Here's a jsFiddle that demonstrates it working.

提交回复
热议问题