html - How to use jQuery for hover effects -
I am trying to keep a hover effect on many images when I have two problems:
1) My alignment is off, when the divisions are currently visible.
2) I can not create a smooth effect after the second (there are four pictures).
HTML:
& lt; Div class = "col-xs-12 col-md-4 col-md-offset-2" & gt; & Lt; Div id = "beach1" & gt; & Lt; / Div & gt; & Lt; Div class = "layer 3" & gt; & Lt; / Div & gt; & Lt; Div class = "layer4" & gt; & Lt; Div class = "magnifyingglass" & gt; & Lt; / Div & gt; & Lt; Img src = "images / magnify.png" class = "img-responsive" id = "enlarge" alt = "magnificent glass" /> & Lt; / Div & gt; & Lt; Div class = "layer 5" & gt; & Lt; Div class = "label" & gt; & Lt; P class = "title" & gt; Household ad file & lt; / P & gt; & Lt; P class = "title 2" & gt; AMT Constant Sadingselling Elite & lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; CSS:
#interview {alt: 300px; Background-image: url (../images/images.jpg); Repeat Background: No Repetition; Margin-down: 40px; } # Find out {margin-top: -35px; Padding: 10px 10px; Z-index: 99 99; } .magnifyingGlass {Height: 34px; Width: 34px; Background color: # 1abc9c; Z-index: 999; } .layer4 {height: 44px; Width: 44px; Background color: RGBA (26, 188, 156, .5); Margin: -210px 20px 0 0; float right; Padding: 5px 5px; Status: Relative; Display: Hide; } .label {height: 65px; Width: 99%; Background color: # 1abc9c; Display area; Status: Relative; Z-index: 999; }. Layer 5 {Height: 75px; Background color: RGBA (26, 188, 156, .5); Margin-top: -115px; Padding: 5px 0 0 5px; Display: Hide; }. Title {font-size: 18px; Color: #fff; Align text: left; Display area; Status: Relative; Padding: 10px 5px; } # Title2 {color: # 087253; Font-size: 12px; Align text: left; Padding: 0 5px; Display area; Status: Relative; } jQuery:
$ (document) .ready (function () {$ ('.layer3'). Mouseover (function () {$ (This) .hide (); $ ('.layer4'). Show (); $ ('.5 layer'). Show ();});}); How to help someone have an idea?
Here are some things wrong.
1: Performance: Hide is invaild
You mean display: none 2: positioning.
To overlap the elements with each other, they should be out of the flow. To do this, use the condition I recommend a relative container with absolute internal elements.
3: Fading
Your jQuery bus is hiding and showing the elements, which is not an infection for it. If you want to be faded out and out, then you can use the functions of jQuery . FadeOut () and . Create custom animations with FadeIn () or . $ (Function () {$ (".3 layer"). Hover (function () {$ (this) .FadeOut (500); $ (" Layer 4, .layer5 "). FadeIn (500);});});
It is very raw.
Comments
Post a Comment