jQuery不会加载 [英] jQuery wont load

查看:90
本文介绍了jQuery不会加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery无法加载.我是菜鸟尝试了很多事情,对语法进行了各种调整.这就是它的样子...

jQuery wont load. I'm a noob. Tried many things, various syntax tweaks. heres how it stands...

在我的硬盘驱动器上使用jQuery,当前版本为jquery-1.7.1(也尝试使用v1.7.1.min).

Using jQuery on my hard drive, current version jquery-1.7.1 (also tried v1.7.1.min).

尝试使用以下插件

1).scrollTo-1.4.2-min
2).jqDock.min& jquery.jqDock
3).jtruncate(current)& jquery.jtruncate.pack
我正在使用IE8和Chrome浏览器检查本地.

1) .scrollTo-1.4.2-min
2) .jqDock.min & jquery.jqDock
3) .jtruncate(current) & jquery.jtruncate.pack
Am using IE8 and Chrome to check on local.

调试说...

(jquery-1.7.1.js)无效字符第1行(注意:第1行只是 信用信息的开头显示为灰色的文本/*! )
(jquery.jtruncate.js)jQuery是未定义的第1行(注意:第1行是 (函数(jQuery){)(我的页面名称)对象不支持此功能 属性或方法代码0第17行Char 5(注意:第17行是$('').jTruncate({)

(jquery-1.7.1.js) invalid character Line 1 (NB: line 1 is just the beginning of the credit info greyed out text /*! )
(jquery.jtruncate.js) jQuery is undefined Line 1 (NB: line 1 is (function(jQuery){ ) (my page name) Object doesnt support this property or method Code 0 Line 17 Char 5 (NB: line 17 is $('').jTruncate({ )

我的邮政编码...

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cressida Haughton - Artist Statement and Biography</title>
    <meta name="description" content="Cressida Haughton - Artist Statement and Biography">

    <meta name="keywords" content="Cressida Haughton,Lab Rat Orchestra,installation,contemporary artist,Coventry,Midlands,Cressida,">

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

<script src="/_js/jquery-1.7.1.js" type="text/javascript" ></script>

<script src="_js/jquery.jtruncate.js" type="text/javascript" ></script>

<script>window.jQuery || document.write("<script src='_js/jquery-1.7.1.min.js'>\x3C/script>")</script> 

<script type="text/javascript">


$(document).ready(function(){
        $('<div id="statement" />').jTruncate({
            length: 200,
            minTrail: 0,
            moreText: "[more]",
            lessText: "[less]",
            ellipsisText: "(truncated)",
            moreAni: "fast",
            lessAni: 2000
        });
    });

然后有Dreamweaver生成的一些Java(滚动图像/交换图像guff),然后是页面特定的CSS(请参见下文),我也有站点范围的外部CSS表单.

Then theres some java generated by Dreamweaver, (Rollover image/swap image guff), then page specific CSS (see below) i also have site wide external css sheet.

    #statement {
        position:absolute;
        left:285px;
        right: 190px;
        top:130px;
        width: 607px;
        height: 321px;
    }

然后是html正文.

Then html body.

任何人都可以帮忙吗?

推荐答案

刚刚尝试了以下操作,它似乎可以正常运行(Chrome),我绝不是jQuery的专家,而是这一行

Have just tried the following and it appears to work ok (Chrome), I am by no means an expert in jQuery but this line

$('<div id="statement"/>') 

看起来没有给我写信,我已在更改的地方发表了评论,请参阅 http: //www.w3schools.com/jquery/jquery_ref_selectors.asp 或更多信息.

does not look write to me, I have commented where I have changed it, look at http://www.w3schools.com/jquery/jquery_ref_selectors.asp or more info.

<body>
  <head>
   <title>test</title>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"> 
   </script>
   <script type="text/javascript">
     /* jtruncate - should be external js file */
     (function($){$.fn.jTruncate=function(h){var i={length:300,minTrail:20,moreText:"more",lessText:"less",ellipsisText:"...",moreAni:"",lessAni:""};var h=$.extend(i,h);return this.each(function(){obj=$(this);var a=obj.html();if(a.length>h.length+h.minTrail){var b=a.indexOf(' ',h.length);if(b!=-1){var b=a.indexOf(' ',h.length);var c=a.substring(0,b);var d=a.substring(b,a.length-1);obj.html(c+'<span class="truncate_ellipsis">'+h.ellipsisText+'</span>'+'<span class="truncate_more">'+d+'</span>');obj.find('.truncate_more').css("display","none");obj.append('<div class="clearboth">'+'<a href="#" class="truncate_more_link">'+h.moreText+'</a>'+'</div>');var e=$('.truncate_more_link',obj);var f=$('.truncate_more',obj);var g=$('.truncate_ellipsis',obj);e.click(function(){if(e.text()==h.moreText){f.show(h.moreAni);e.text(h.lessText);g.css("display","none")}else{f.hide(h.lessAni);e.text(h.moreText);g.css("display","inline")}return false})}}})}})(jQuery);
    </script>
  </head>
  <body>
    <!-- truncatable div element -->
    <div id="statement">
      <p>This is a statement</p>
    </div>  
    <script type="text/javascript">
       $(document).ready(function(){
          /* changed from $('<div id="statement" />') */
          $('#statement').jTruncate({
              length: 5,
              minTrail: 0,
              moreText: "[more]",
              lessText: "[less]",
              ellipsisText: "(truncated)",
              moreAni: "fast",
              lessAni: 2000
          });
      });
    </script>
  </body>
</html>

希望这对您有帮助,圣诞快乐:-)

Hope this helps, merry christmas :-)

这篇关于jQuery不会加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆