加载页面无法正常工作

时间:2013-11-10 08:22:42

标签: javascript jquery css

我有这个标记:

<div id="logo" style="text-align:center;">
    <p>AXIS'14</p>
    <a id="enter" onclick="EnterSite()">Enter Website</a><br>
</div>

<div id="content">
  //content here
</div>  

和javascript:

<script>
        $(window).load(function(){
         // executes when complete page is fully loaded, including all frames, objects and images
         $("#enter").fadeIn(1000);
        });
</script>  

<script type="text/javascript">
        $(window).load(function EnterSite() {
            $("#logo").fadeOut(500);      
            $("#content").fadeIn(1000);
        });
                //this initialize the grid gallery

        $(function() {
            $( '#sg-panel-container' ).gridgallery();
        });
</script>   

我想要的是在加载窗口后,应该会出现 Enter Website 链接,点击该链接会淡出 logo div并显示 content div。目前正在发生的事情是 here

1 个答案:

答案 0 :(得分:1)

你应该这样做:

<script>
        $(window).load(function(){
         // executes when complete page is fully loaded, including all frames, objects and images
         $("#enter").fadeIn(1000);
        });
</script>  

<script type="text/javascript">
        $(document).ready(function () {
            $("#enter").click(function () {
                $("#content").fadeIn(1000);
            });
        });
            $(document).ready(function(){
                $("#enter").click(function () {
                $( '#sg-panel-container').gridgallery();
            });
        });
</script>