jQuery插件不起作用 [英] JQuery plugin not working

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

问题描述

所以我有这个插件 http://www.myjqueryplugins.com/jRating 我下载了它,并在新的空白页上尝试了一下,看是否可以这样做.有效. 现在的问题是,我将此插件放在我的网站上,并像在空白页中那样进行了完全正确的操作,但是这次插件不起作用.是因为我在实际网站上使用原始的jquery函数还是其他东西? 无法在线上传我的所有文件..但这是重要的部分

So I have this plugin http://www.myjqueryplugins.com/jRating I downloaded it and tried it on a new blank page just to see if I can do it. It worked. The problem now is I put this plugin on my site and did the EXACT things as I did in the blank page, but this time the plugin is not working. Is it because I'm using the original jquery functions on the actual site or something? Cant upload all my files online .. but here are the important parts

这是进口

<!-- styles -->
<link rel="stylesheet" type="text/css" href="styles/general.css"/>
<link rel="stylesheet" type="text/css" href="styles/place-event.css"/>
<link rel="stylesheet" type="text/css" href="styles/homepage.css"/>
<link rel="stylesheet" type="text/css" href="styles/css-buttons.css"/>
<link rel="stylesheet" type="text/css" href="styles/colors.css"/>

<!-- plugin jRate -->
<link rel="stylesheet" type="text/css" href="plugin/jrate/jquery/jRating.jquery.css"/>
<script type="text/javascript" src="plugin/jrate/jquery/jRating.jquery.js"></script>

<!-- scripts -->
<script type="text/javascript" src="scripts/removeTextClick.js"></script>
<script type="text/javascript" src="scripts/jquery-1.4.4.min.js"></script>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>

这是jquery代码

<script type="text/javascript">

$(document).ready(function(){

    $("#abso").hide();
    $("#close").hide();


    $("#places-feed").load("eventPictures.html");
    $("#comments").load("commentsOnEvent.html");
    $("#insert-activity").load("newsFeed.html");
    $("#list-friends-feed-link").load("friendsCount.html");
    $("#notify").load("notificationCount.html");
    $("#list-groups-feed-link").load("groupsCount.html");


    $("#list-friends-feed-link").click(function(){ //start click

        $("#abso").load("listFriendsFeed.html");
        $("#abso").slideDown("600", function(){});
        $("#close").slideDown("600", function(){});

    }); //end click

    $("#list-pictures-feed-link").click(function(){ //start click

        $("#abso").load("picFeed.html");

        $("#abso").slideDown("600", function(){});
        $("#close").slideDown("600", function(){});
    }); //end click

    $("#list-groups-feed-link").click(function(){ //start click

        $("#abso").load("listGroupsFeed.html");

        $("#abso").slideDown("600", function(){});
        $("#close").slideDown("600", function(){});
    }); //end click

    $("#notify").click(function(){ //start click

        $("#abso").load("notifications.html");

        $("#abso").slideDown("600", function(){});
        $("#close").slideDown("600", function(){});
    }); //end click

    $("#upload-pic-place-gallery").click(function(){ //start click

        $("#abso").load("uploadPicPlaceGallery.html");

        $("#abso").slideDown("600", function(){});
        $("#close").slideDown("600", function(){});
    }); //end click

    $("#close").click(function(){ //start click

        $("#abso").slideUp("600",function(){});
        $("#close").slideUp("600",function(){});
    }); //end click


    // this block is for jRate plugin

    $(".ratings").jRating();

    // ---



});


</script>

最后,这是一些代码,其中包含插件使用的html中的div

finally this is some of the code that includes the div in the html that the plugin uses

<div id="the-place-event-div"> <!-- the place event div start -->

<div id="for-top-box"> <!-- for top box start -->
<a>
<img src="images/welcome.png"/>
</a>

<div id="place-description"><p>where awesomeness meets awesome</p> <!-- place description start -->
<p id="date-time">Date:<a>21/08/2010</a> Time:<a>07:00am</a></p>

<div class="ratings" data="12_1"> <!--rating div start -->



</div> <!-- ratings div end -->



 </div> <!-- place description end -->



</div> <!-- for top box end -->

推荐答案

问题是您在引用jQuery文件之前添加了对插件的引用.

The problem is that you are adding a reference to your plugin before refering to jQuery file.

<script type="text/javascript" src="scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="plugin/jrate/jquery/jRating.jquery.js"></script>

这应该有效.

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

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