简体   繁体   中英

Why isn't my css fisheye dock menu working?

My css fisheye dock menu isn't working. I am trying to implement it into my wordpress website. I downloaded it from http://ndesign-studio.com/blog/css-dock-menu . I changed some of the css to position it how I wanted to on my page inside a container div at the bottom under my footer but the fisheye effect isn't working. Can anyone help me out?

The HTML:

<!--bottom dock - fisheye menu -->
<div class="dock" id="dock2">
  <div class="dock-container2" style="left: 760px; width: 400px;">
<a class="dock-item2" style="left: 0px; width: 40px;" href="http://www.linkedin.com/company/ostech-pty-ltd."><span style="display: none;">LinkedIn</span><img src="/wp-content/themes/bluefantasy/images/LinkedIn_icon.png" alt="LinkedIn"></a>
<a class="dock-item2" style="left: 40px; width: 40px;" href="https://www.facebook.com/OSTechCorp"><span style="display: none;">Facebook</span><img src="/wp-content/themes/bluefantasy/images/facebook_icon.png" alt="Facebook"></a>
<a class="dock-item2" style="left: 80px; width: 40px;" href="https://twitter.com/ostech"><span style="display: none;">Twitter</span><img src="/wp-content/themes/bluefantasy/images/Twitter_icon.png" alt="Twitter"></a>
  </div>
</div>

The CSS:

#dock2 {
    width: 100%;
    bottom: 0px;
    color: #000;
    left: 0px;

}
.dock-container2 {

    height: 50px;
    background: #000000;
    padding-left: 20px;
    vertical-align: middle;

}
a.dock-item2 {
    display: block; 
    font: bold 12px Arial, Helvetica, sans-serif;
    width: 40px; 
    color: #000; 
    bottom: 0px; 
    position: absolute;
    text-align: center;
    text-decoration: none;
}
.dock-item2 span {
    display: none;
    padding-left: 20px;
}
.dock-item2 img {
    border: none; 
    margin: 5px 10px 0px; 
    width: 100%; 
}
#wrap {

    width: 980px;

    height: auto;

    margin-right: auto;

    margin-left: auto;

    overflow: hidden;

    position:relative;



}

The javascript in the body:

<script type="text/javascript">
    $(document).ready(
        function()
        {

            $('#dock2').Fisheye(
                {
                    maxWidth: 30,
                    items: 'a',
                    itemsText: 'span',
                    container: '.dock-container2',
                    itemWidth: 40,
                    proximity: 80,
                    alignment : 'left',
                    valign: 'bottom',
                    halign : 'center'
                }
            )
        }
    );
</script>

There is also two external scripts jquery.js and interface.js.

Replace your block with the below code:

<script type="text/javascript">

var AddFishEye = function(){
          $('#dock2').Fisheye(
                {
                    maxWidth: 30,
                    items: 'a',
                    itemsText: 'span',
                    container: '.dock-container2',
                    itemWidth: 40,
                    proximity: 80,
                    alignment : 'left',
                    valign: 'bottom',
                    halign : 'center'
                }
            );
    };

$(document).ready(function(){
   AddFishEye(); 
});

</script>

Update

Also, you need few changes to make in your CSS also:

#dock2 {
    width: 100%;
    bottom: 0px;
    color: #000;
    left: 0px;
    position:absolute;

}
.dock-container2 {
position:absolute;
    height: 50px;
    background: #000000;
    padding-left: 20px;
    vertical-align: middle;

}
a.dock-item2 {
    display: block; 
    font: bold 12px Arial, Helvetica, sans-serif;
    width: 40px; 
    color: #000; 
    bottom: 0px; 
    position: absolute;
    text-align: center;
    text-decoration: none;
}
.dock-item2 span {
    display: none;
    padding-left: 20px;
}
.dock-item2 img {
    border: none; 
    margin: 5px 10px 0px; 
    width: 100%; 
}
#wrap {

    width: 980px;

    height: auto;

    margin-right: auto;

    margin-left: auto;

    overflow: hidden;

    position:relative;

}

Hers's a demo fiddle:

http://jsfiddle.net/sunnykumar08/u7qX2/

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM