jquery不起作用,在这里找不到合适的答案

时间:2015-11-11 13:16:53

标签: javascript jquery html

带有jquery链接的html代码

@Override
public int compareTo(Human other){
    if(other instanceof Athlete){
        return compareTo((Athlete)other);
    }

    return super.compareTo(other);
}

public int compareTo(Athlete other){
    int result = super.compareTo((Human)other);

    if(result == 0){
        return this.year - other.year;
    }

    return result;
}

在这里,我想开始我的悬停功能。

<!DOCTYPE html>

<html>
    <head>

        <!-- metadata -->
        <meta charset="UTF-8">

        <meta name="keywords" content="bas webdesign, beverwijk, heemskerk, uitgeest, ijmuiden, velsen, noord holland, noord-holland, nederland, responsive webdesign, website bouwen, goedkoop, kwaliteit, betrouwbaar, html 5, css 3, javascript, huisstijl, huisstijlen">
        <meta name="viewport" content="width=device-width user-scalable=no">

            <!-- socialmedia -->
            <meta property="og:site_name" content="www.bas-webdesign.nl"/>
            <meta property="og:title" content="Investeer in je bedrijf, investeer in een goede website!"/>
            <meta property="og:description" content="Bas webdesign maakt websites op maat voor elk budget. Jij bepaalt, Bas maakt. Advies is bij Bas een service. En service is gratis, zoals het hoort! Neem gerust contact op en kom eens op de koffie voor een vrijblijvend gesprek."/>
            <meta property="og:image" content="afb/sociaal/socialeMediaThumbnail.jpg">
            <meta property="og:url" content="http://bas-webdesign.nl/">
            <meta property="og:type" content="Webdesign"/>
            <!-- socialmedia -->

        <!-- metadata -->


        <!-- links -->

            <!-- favicon -->
            <link rel="shortcut icon" href="afb/logo/favicon.png" type="image/x-icon">
            <link rel="icon" href="afb/logo/favicon.png" type="image/x-icon">
            <!-- favicon -->

            <!-- fonts -->
            <link href='http://fonts.googleapis.com/css?family=Josefin+Sans:400,700' rel='stylesheet' type='text/css'>
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
            <!-- fonts -->

            <!-- standaard -->
            <link rel="stylesheet" href="css/reset.css">
            <link rel="stylesheet" href="css/style.css">
            <!-- standaard -->

        <!-- links -->


        <!-- script -->

            <!-- jquery -->
            <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
            <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
            <!-- jquery -->

        <script src="js/actions.js"></script>
        <script src="js/smooth-scroll.js"></script> <!-- gebruik "data-scroll" in de a tag voor smoothscroll -->
        <!-- script -->


        <title>Bas Webdesign</title>

    </head>


    <body>

        <!-- omhuller -->
        <div class="omhuller">

            <!-- header -->
            <header id="header">

                <!-- logo -->
                <img src="afb/logo/logo.png">
                <!-- logo -->

                <!-- hoofdmenu -->
                <section id="hoofdmenu">

                    <ul>

                        <li>
                            <span id="menuIcoon_website" class="fa fa-globe" onmouseover="hoverAan(menuIcoon_website, menuTekst_website)"></span>
                            <a href="websites/" id="menuTekst_website" class="onzichtbaar" onmouseout="hoverUit(menuIcoon_website, menuTekst_website)">websites</a>

                        </li>

                        <li>

                        </li>

                        <li>

                        </li>

                        <li>

                        </li>

                    </ul>

                </section>
                <!-- hoofdmenu -->

            </header>
            <!-- header -->

        </div>
        <!-- omhuller -->


        <script>
            smoothScroll.init();
        </script>

    </body>
</html>

事情是......没有$( document ).ready(function() { // globale variabelen // globale variabelen // functies // hover function hoverAan(onzichtbaar, zichtbaar){ onzichtbaar.style.display = "none"; zichtbaar.style.display = "inline"; } // hover // functies }); (如此简单的js)它确实有效。它是jquery链接的位置吗?还是有别的我做错了?因为我想写很多jquery link and .ready()而不是jquery。所以我想确保它从一开始就完成这项工作......现在却没有。

1 个答案:

答案 0 :(得分:0)

您希望将所有JavaScript功能保留在$(document).ready(function () {});之外。这样,您的函数将与HTML一起加载,而不是在加载HTML后加载函数。