SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with a jQuery star rating script

    Hi,

    I'm trying to implement this star rating script and can't seem to get it to work.

    Keep in mind that I'm not a programmer and I have no idea what I'm doing with jQuery. I'm just trying to copy and paste code and make it work with my site....it's not working.

    Here's the site: http://sandbox.wilstuckey.com/jquery-ratings/

    1. I've copied the source and created a javascript file called jquery.rating.js.

    2. I've copied the form code and pasted it into my template.

    3. I copied the javascript and placed it into the head of my document.

    Nothing happens.

    I noticed while viewing the source of that example, the author has this in the head of the html file:

    Code:
    <script type="text/javascript" src="../jquery/dist/jquery.js"></script>
        <script type="text/javascript" src="js/jquery.rating.js"></script>
    
        <script type="text/javascript">        
            jQuery(function(){
                jQuery('form.rating').rating().animate({opacity: 'show'}, 2000);
            });
        </script>
    The author did not supply the jquery.js file in the example, do I need it too?

    Do I need to download the images of the stars? Or how is that done?

    Note: I'm testing this locally on my machine. Not sure if I need to upload it to my server or not to make it work (but don't think so)
    __________________
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore

  2. #2
    SitePoint Member
    Join Date
    May 2003
    Location
    Connecticut
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Take Everything

    You will need to upload both the jquery.js file, which you can get at jquery.com if you have not already gotten it, and the jquery.rating.js as well.

    You will also want to take the CSS from the page you linked us too and the images as well if you want to use the same images.

  3. #3
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by md_doc View Post
    You will need to upload both the jquery.js file, which you can get at jquery.com if you have not already gotten it, and the jquery.rating.js as well.

    You will also want to take the CSS from the page you linked us too and the images as well if you want to use the same images.

    Hi,

    Thank you very much for your help!

    Can you tell me why the script is always starting the rating off at 3 1/2 stars? Why is it not starting at zero?

    Last thing, what (if any) functionality is in place to stop duplicate ratings? It's not a huge deal because I'm sure no matter what there are ways around it, but I would like for people to not be able to rate and then click refresh and then rate again.

    thanks
    Last edited by deronsizemore; Oct 5, 2007 at 05:33.
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore

  4. #4
    SitePoint Member
    Join Date
    May 2003
    Location
    Connecticut
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The remove one should give a rating of 0... so the person is saying they give it a 0 out of 5 stars. If you want the lowest rating to be 1... then it seems like it would be reasonable to just remove the "-" image.

  5. #5
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by md_doc View Post
    The remove one should give a rating of 0... so the person is saying they give it a 0 out of 5 stars. If you want the lowest rating to be 1... then it seems like it would be reasonable to just remove the "-" image.
    Well basically what I've done is I removed the option 0 so that only stars show and no delete button.

    So, now I'm left with five stars. It seems that no matter what the rating always starts out on 3.5. Ideally, I would think that until someone rates it, no stars would be highlighted at all. (Even on the example website it starts off at 3.5 stars).

    When I click on a rating, it doesn't seem to be "sticking" either. I load the page and the rating is on 3.5 stars. So I click on a rating of 5 and it goes up to 5. Once I refresh the page, the rating drops back down to 3.5. What's going on there?
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •