Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP throwing jQuery error trying to close sitewide notice on homepage?

  • Profile photo of rossagrant
    rossagrant
    Participant

    @rossagrant

    Hi guys,

    Got a bit of a mystery I’m hoping someone can look at.

    I’m having issues with sitewide notices.

    I post a notice, it shows in the overlay no problem – all is good.

    Now the notice can be closed on all pages except my homepage.

    It’s odd, but I click the close button and the page just refreshes and the notice appears again.

    I’m seeing the following error.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Profile photo of rossagrant
    rossagrant
    Participant

    @rossagrant

    Oh, it won’t let me post code, even between tags?

    Profile photo of Henry Wright
    Henry Wright
    Moderator

    @henrywright

    Hi @rossagrant

    Try using Pastebin

    Profile photo of rossagrant
    rossagrant
    Participant

    @rossagrant

    Will post as a pic instead:

    http://postimg.org/image/p6reyra3p/

    Profile photo of rossagrant
    rossagrant
    Participant

    @rossagrant

    When I google that error I see posts referring to WP running it’s jQuery library in no-conflict mode.

    People say that errors like this are syntax issues – the jQuery library included with WordPress loads in “no conflict” mode. This is to prevent compatibility problems with other javascript libraries that WordPress can load. In “no-confict” mode, the $ shortcut is not available and the longer jQuery is used, i.e.

    jQuery(document).ready(function ($) {

    By including the $ in parenthesis after the function call you can then use this shortcut within the code block.

    This is a bit beyond me – does anyone else see this behaviour and have any idea if the above solution is implemented in BP to cause no conflicts?

    Would love some help!

    Ross :)

    Profile photo of rossagrant
    rossagrant
    Participant

    @rossagrant

    Here’s the error in pastebin:

    http://pastebin.com/V3q3WdyS

    Profile photo of Henry Wright
    Henry Wright
    Moderator

    @henrywright

    I’m no expert in jQuery but I think buddypress.js uses jq to reference jQuery. And it’s perfectly OK to do that if you do something like this var jq = jQuery; (which buddypress.js does). I don’t think the problem is with buddypress.js. Instead, check jQuery is enqueued on your homepage. And also check you’re enqueueing it just once.

    Profile photo of rossagrant
    rossagrant
    Participant

    @rossagrant

    @henrywright Cheers Henry – I’ve passed this on.

    I’ll report back what I find if we manage to fix it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘BP throwing jQuery error trying to close sitewide notice on homepage?’ is closed to new replies.