Javascript / CSS动画在Firefox中的工作方式与在Chrome中的工作方式不同

时间:2013-09-05 22:14:09

标签: html css google-chrome cross-browser

我制作的代码可以在悬停时上下移动我的导航栏,并且它在chrome和Mozilla上完美运行但是当我添加滑块时它仍然可以在Chrome上工作但在Mozilla上它已经坏了(见截图)。

这有点类似 http://jsfiddle.net/wmYk5/

这是我从www .menucool.com / javascript-image-slider (DEMO 1)

获取滑块的地方

http://i.stack.imgur.com/wJpn5.png< ----图片链接,您可以看到它

在Chrome上,它不会像图片1一样只在mozzila和IE上移动......

这是我的HTML代码

<div id="nav_bar_menu">

                <a id="nav_bar_a" href="index.html" ><li class="pocetna" id="nav_bar_menu_bars"><div id="nav_bar_paragraf1" class="nav_bar_paragraf_class">POČETNA</div></li></a>
                <a id="nav_bar_a" href="Usluge.html" ><li class="usluge" id="nav_bar_menu_bars"><div id="nav_bar_paragraf2" class="nav_bar_paragraf_class">USLUGE</div></li></a>
                <a id="nav_bar_a" href="Projekti.html" ><li class="projekti" id="nav_bar_menu_bars"><div id="nav_bar_paragraf3" class="nav_bar_paragraf_class">PROJEKTI</div></li></a>
                <a id="nav_bar_a" href="Kontakt.html" ><li class="kontakt" id="nav_bar_menu_bars"><div id="nav_bar_paragraf4" class="nav_bar_paragraf_class">KONTAKT</div></li></a>

     <script type="text/javascript" >

    $(document).ready(function() {

        $('.nav_bar_paragraf_class').animate({

            opacity:0.5

        });

        $('.pocetna').hover(function() {
            $('#nav_bar_paragraf1').stop().animate({opacity:1}, 'fast');
        }, function() {
            $('#nav_bar_paragraf1').stop().animate({opacity:0.5}, 'slow');
        });
        $('.usluge').hover(function() {
            $('#nav_bar_paragraf2').stop().animate({opacity:1}, 'fast');
        }, function() {
            $('#nav_bar_paragraf2').stop().animate({opacity:0.5}, 'slow');
        });
        $('.projekti').hover(function() {
            $('#nav_bar_paragraf3').stop().animate({opacity:1}, 'fast');
        }, function() {
            $('#nav_bar_paragraf3').stop().animate({opacity:0.5}, 'slow');
        });
        $('.kontakt').hover(function() {
            $('#nav_bar_paragraf4').stop().animate({opacity:1}, 'fast');
        }, function() {
            $('#nav_bar_paragraf4').stop().animate({opacity:0.5}, 'slow');
        });
    });

</script>
</div><!-- Menu -->

        <div id="nav_bar_line"></div>



<div id="sliderFrame">
        <div id="slider">

            <img src="images slider/image-slider-1.jpg" alt="First Image" />
            <img src="images slider/image-slider-2.jpg" alt="Second Image" />
            <img src="images slider/image-slider-3.jpg" alt="Third Image" />
            <img src="images slider/image-slider-4.jpg" alt="#htmlcaption" />
            <img src="images slider/image-slider-5.jpg" />
        </div>

    </div>

这是我的css代码

#nav_bar_menu {
    height: 38px;
    width: 580px;
    float: right;
    margin-left: 25px;
    margin-right: 25px;
    margin-top: 93px;
    overflow: hidden;

}
#nav_bar_menu_bars {
    height: 78px;
    width: 131px;
    margin-right: 14px;
    display: inline;
    float: left;
}


.pocetna, .usluge, .projekti, .kontakt {
    background-image: url(../Images/images/nav_bar_pictures_01.jpg);
    background-repeat: no-repeat;
    background-position: center top;
    -moz-transition: top 0.7s;
    -webkit-transition: top 0.7s;
    -o-transition: top 0.7s;
    transition: top 0.7s;
    position: relative;
    top: 0px;
    float: left;
 }


.pocetna:hover {
    position:relative;
    top:-38px;
}
.usluge:hover {
    position:relative;
    top:-38px;
}
.projekti:hover {
    position:relative;
    top:-38px;
}
.kontakt:hover {
    position:relative;
    top:-38px;
}
#nav_bar_paragraf1 {
    position: fixed;
    font-family: Arial, Helvetica, sans-serif;
    text-decoration: none;
    font-weight: bold;
    color: #FFF;
    margin-left: 26px;
    padding-bottom: 10px;
    margin-top: 10px;
    display: block;
}
#nav_bar_paragraf2 {
    position: fixed;
    font-family: Arial, Helvetica, sans-serif;
    text-decoration: none;
    font-weight: bold;
    color: #FFF;
    margin-top: 10px;
    padding-bottom: 10px;
    margin-left: 31px;
}
#nav_bar_paragraf3 {
    position: fixed;
    font-family: Arial, Helvetica, sans-serif;
    text-decoration: none;
    font-weight: bold;
    color: #FFF;
    margin-top: 10px;
    margin-left: 25px;
    padding-bottom: 10px;
}
#nav_bar_paragraf4 {
    position: fixed;
    font-family: Arial, Helvetica, sans-serif;
    text-decoration: none;
    font-weight: bold;
    color: #FFF;
    margin-top: 10px;
    margin-left: 26px;
    padding-bottom: 10px;
}

0 个答案:

没有答案