SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Location
    Preston, Lancashire
    Posts
    1,376
    Mentioned
    71 Post(s)
    Tagged
    1 Thread(s)

    jQuery on website not working, but working externally

    Hiya there.

    I have a website here, and the jquery is not working. On it's external file here it works perfectly. The website is in WordPress so I am not sure if I have done something wrong. I tried the IRC channels but nobody seams to know what it is.

    Can anybody shed light on this, spent all day on it.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!

  2. #2
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Usually i see this happen when conflicting javascript or jquery. Also are the paths correct. I have seen some scripts not like having absolute paths. Also is this before wordpress jquery call ? There could be tons of reasons but without having access it is hard to tell from just looking at it.

  3. #3
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Location
    Preston, Lancashire
    Posts
    1,376
    Mentioned
    71 Post(s)
    Tagged
    1 Thread(s)
    It's understandable that you need the files. I included the source code file for the major files associated with the homepage

    page-home.php - http://pastebin.com/7Usf3FTb
    header.php - http://pastebin.com/W7Mx6Zth
    footer.php - http://pastebin.com/SpKUs1ic
    functions.php - http://pastebin.com/4T6sAAvH

    Since then I've tried a few tricks, including, using jQueries no conflict mode, which still not did not work - http://codex.wordpress.org/Function_...enqueue_script. I also used this, but no cigar -http://api.jquery.com/jQuery.noConflict/.

    I know this is probably most likely due to inexperience. Since then I am looking more into jQuery and I am going to go through these tutorials so it can help me in the future. - http://net.tutsplus.com/articles/web...-video-series/. My site is a WP site.

    I hope this helps to try and figure out what's up with the site.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Sega View Post
    I have a website here, and the jquery is not working.
    I've taken a look a web site and the jQuery on there seems to be working fine with what you currently have there.
    If the problem is being had with something else, please link us to a page that demonstrates the problem that you are having.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I went to your site and it has a maintenance pop up. Is everything working now ?

  6. #6
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Location
    Preston, Lancashire
    Posts
    1,376
    Mentioned
    71 Post(s)
    Tagged
    1 Thread(s)
    Sorry, I was working on an additional section to the site, so maintenance mode was up.

    It's now online again. I am still puzzled on what's wrong with it and why it does not work. Somebody mentioned isolation mode in jQuery but that did nothing.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!

  7. #7
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    One thing i see real quick is the header.php is not correct you have

    <?php wp_head();

    without the ending tags.

    it should be

    <?php wp_head(); ?>

    Also i would not put css in the header.

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Sega View Post
    Sorry, I was working on an additional section to the site, so maintenance mode was up.

    It's now online again. I am still puzzled on what's wrong with it and why it does not work. Somebody mentioned isolation mode in jQuery but that did nothing.
    First of all, remove that noconflict part. It shouldn't be used unless you understand what it's used for and way.

    Second, you have the jQuery library loading twice.
    First it loads and then the sexy slider is loaded. Then you're loading the jQuery library again for something else, which results in destroying that first one (and the sexyslider that attached itself on to the original jQuery).
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    remove my comment as Paul said same thing i did.

  10. #10
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Location
    Preston, Lancashire
    Posts
    1,376
    Mentioned
    71 Post(s)
    Tagged
    1 Thread(s)
    @mmoore5553 ;
    @paul_wilkins ;

    The header region is okay, it's done in PHP and echoing everything out instead. The CSS is there because of the slider. I don't want it there and once I see things working I will remove it and try and put it in an external file.

    I've updated the scripts now. I removed the no conflict part and also remove the additional call to the jQuery library, which is now being loaded through functions.php. I am not too sure I've everything is done, but it's still broken.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!

  11. #11
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Sega View Post
    I am not too sure I've everything is done, but it's still broken.
    The only thing that seems wrong now is that some of the slider init code has been inappropriately cut out.

    Currently you have this:

    Code:
     jQuery(document).ready(function() {
        $("#slider").SexySlider({
            ...
    });
    You are missing a part there from when closing off the slider init code.

    Code:
     jQuery(document).ready(function() {
        $("#slider").SexySlider({
            ...
        });
    });
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #12
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Location
    Preston, Lancashire
    Posts
    1,376
    Mentioned
    71 Post(s)
    Tagged
    1 Thread(s)
    okay, it's done and now it seams to be working fine, thanks!

    So to sum things up it was the missing end bit that did it for me and maybe the additional jQuery?

    Let me know if there is anything else, because I will have to put my site back on maintenance mode to get working on the blog section, and also fixing up the appearance of the slider.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!

  13. #13
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Good catch paul on the script part. I did not even bother looking at it.

  14. #14
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by mmoore5553 View Post
    Good catch paul on the script part. I did not even bother looking at it.
    I didn't either until the other issues were resolved.
    When the debugger claimed an unexpected end of input at line #1, that prompted a further investigation.

    Step by step, resolving issues one by one. That's how these things are solved.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  15. #15
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Location
    Preston, Lancashire
    Posts
    1,376
    Mentioned
    71 Post(s)
    Tagged
    1 Thread(s)
    Oh man, I got to get into jQuery more, thanks again Paul.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!


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
  •