0

请参阅下面的页面标题...

当我打电话

    jkmegamenu.definemenu("megaanchor0", "megamenu0", "mouseover");
    jkmegamenu.definemenu("megaanchor2", "megamenu2", "mouseover");
    jkmegamenu.definemenu("megaanchor3", "megamenu3", "mouseover");
    jkmegamenu.definemenu("megaanchor4", "megamenu4", "mouseover");

到没有准备好文档的页面,大型菜单工作正常。当我将呼叫置于文档就绪功能中时,菜单不会加载。

有任何想法吗?(见http://pushpinevents.com/alarm/index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Alarm of America</title>


<script  type="text/javascript" src="java/jquery-1.10.1.min.js"></script>

<script  type="text/javascript" src="java/jkmegamenu.js"></script>

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

    jkmegamenu.definemenu("megaanchor0", "megamenu0", "mouseover");
    jkmegamenu.definemenu("megaanchor2", "megamenu2", "mouseover");
    jkmegamenu.definemenu("megaanchor3", "megamenu3", "mouseover");
    jkmegamenu.definemenu("megaanchor4", "megamenu4", "mouseover");

    });
</script>




<script  type="text/javascript" src="java/slides.js"></script>


<script  type="text/javascript" src="curvycorners.src.js"></script>





<script type="text/javascript">
$('#mainbanner').ready(function() {
      $("#slides").slidesjs({
        width: 842,
        height: 325,
    play: {
      active: false,
        // [boolean] Generate the play and stop buttons.
        // You cannot use your own buttons. Sorry.
      effect: "fade",
        // [string] Can be either "slide" or "fade".
      interval: 2000,
        // [number] Time spent on each slide in milliseconds.
      auto: true,
        // [boolean] Start playing the slideshow on load.

      pauseOnHover: true,
        // [boolean] pause a playing slideshow on hover
      restartDelay: 2500,
        // [number] restart delay on inactive slideshow

    },

    navigation: false



      });
    });
  </script>

<link href="style.css" rel="stylesheet" type="text/css" />

</head>

和html...

  <li><a href="#" id='megaanchor0'>Residential</a></li>

        <span id="megamenu0" class="megamenu">
         <div class="column">

        <ul>

        <li><a href='#'>Home Security with Fire Protection</a></li>
        <li><a href='#'>Video Surveillance</a></li>
        <li><a href='#'>Phone, Cable, Office and Satellite Wiring &amp; Trim</a></li>
        <li><a href='#'>TV Purchase &amp; Installation</a></li>
        <li><a href='#'>No Phone Required Systems</a></li>
        <li><a href='#'>Look-in Video Systems</a></li>


        </ul>
        </div>


        <div class="column">

        <ul>

        <li><a href='#'>Remote Access to Securty System</a></li>
        <li><a href='#'>Computer and Smart Phone Apps</a></li>
        <li><a href='#'>Blue Alert Home Healthcare System</a></li>
        <li><a href='#'>Security Screens</a></li>
        <li><a href='#'>Cell Back-up Systems using Tellular or Uplink</a></li>
        <li><a href='#'>SAFEGUARD Inspection Service</a></li>


        </ul>
        </div>



        </span>
4

2 回答 2

0

document.ready()我会在页面末尾打一个电话,如下所示:

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

    jkmegamenu.definemenu("megaanchor0", "megamenu0", "mouseover");
    jkmegamenu.definemenu("megaanchor2", "megamenu2", "mouseover");
    jkmegamenu.definemenu("megaanchor3", "megamenu3", "mouseover");
    jkmegamenu.definemenu("megaanchor4", "megamenu4", "mouseover");

    $("#slides").slidesjs({
        width: 842,
        height: 325,
        play: {
          active: false,
          // [boolean] Generate the play and stop buttons.
          // You cannot use your own buttons. Sorry.
          effect: "fade",
          // [string] Can be either "slide" or "fade".
          interval: 2000,
          //[number] Time spent on each slide in milliseconds.
          auto: true,
          //[boolean] Start playing the slideshow on load.

          pauseOnHover: true,
          // [boolean] pause a playing slideshow on hover
          restartDelay: 2500,
          // [number] restart delay on inactive slideshow
        }, 
       navigation: false
   });
  });
</script>

使用您当前的代码,您正在定义菜单,document.ready()以便在所有 html 已加载并添加到 DOM 时添加它们。#mainbanner但是你在加载之前就调用 slideJS document.ready(),这就是为什么将它们放在同一个调用中并以正确的顺序应该可以解决你的问题。

于 2013-06-16T13:52:59.390 回答
0

原来我在样式之前加载了 javascript。我换了这些,现在一切都很好了:D。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Alarm of America</title>

<link href="style.css" rel="stylesheet" type="text/css" />


<script  type="text/javascript" src="java/jquery-1.10.1.min.js"></script>

<script  type="text/javascript" src="java/jkmegamenu.js"></script>

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

    jkmegamenu.definemenu("megaanchor0", "megamenu0", "mouseover");
    jkmegamenu.definemenu("megaanchor2", "megamenu2", "mouseover");
    jkmegamenu.definemenu("megaanchor3", "megamenu3", "mouseover");
    jkmegamenu.definemenu("megaanchor4", "megamenu4", "mouseover");

    });
</script>




<script  type="text/javascript" src="java/slides.js"></script>


<script  type="text/javascript" src="curvycorners.src.js"></script>





<script type="text/javascript">
$('#mainbanner').ready(function() {
      $("#slides").slidesjs({
        width: 842,
        height: 325,
    play: {
      active: false,
        // [boolean] Generate the play and stop buttons.
        // You cannot use your own buttons. Sorry.
      effect: "fade",
        // [string] Can be either "slide" or "fade".
      interval: 2000,
        // [number] Time spent on each slide in milliseconds.
      auto: true,
        // [boolean] Start playing the slideshow on load.

      pauseOnHover: true,
        // [boolean] pause a playing slideshow on hover
      restartDelay: 2500,
        // [number] restart delay on inactive slideshow

    },

    navigation: false



      });
    });
  </script>


</head>
于 2013-06-17T01:45:44.897 回答