Simple Lightbox
[resolved] Clash with jQuery (7 posts)

  1. johnevanofski
    Posted 3 years ago #

    Hi there,

    I'm having an issue where the jQuery Easing plugin appears to be clashing with this plugin and subsequently disabling jQuery on my page.

    The error comes in at line 46 on the jQuery Easing v1.3; this issue resolves when I disable the lightbox plugin.

    "Uncaught TypeError:Property 'undefined' of object #<Object> is not a function

    Thank you!


  2. johnevanofski
    Posted 3 years ago #

    Here's the page effected: http://johnevanofski.net

  3. Archetyped
    Plugin Author

    Posted 3 years ago #

    Hi, I'm not seeing the same error you're referring to, but it does look like jQuery is being loaded twice for the page. The first time appears to be hardcoded in the theme's markup, while the other is loaded by WordPress itself.

    Themes and plugins should always load scripts and styles via WP's file loading API (e.g. using wp_enqueue_script()). WP will automatically stop scripts from being loaded multiple times when scripts are loaded in this way, which can alleviate many issues.

    Let me know if you're still experiencing the same issue once you get the theme's scripts loaded using wp_enqueue_script() and I'd be glad to take another look.

  4. johnevanofski
    Posted 3 years ago #

    That seems to have resolved the issue, I used:

        function my_scripts_method() {
                get_template_directory_uri() . '/js/jquery.easing.1.3.js',
        add_action('wp_enqueue_scripts', 'my_scripts_method');

    Also note to anyone with the problem in the future you will need to take your $(...) method out in leu of jQuery(...)

  5. Archetyped
    Plugin Author

    Posted 3 years ago #

    Glad your issue was resolved.

    Also, the use of $() as an alias for jQuery() should not be affected. Did you mean something else?

  6. johnevanofski
    Posted 3 years ago #

    No, it appears that I have to use the jQuery() alias otherwise the code doesn't work.

    It even says something about it in the wp_enqueue_script() doc


  7. Archetyped
    Plugin Author

    Posted 3 years ago #

    As long as you wrap the code in an immediately executing anonymous function (as described in the link you posted), $() can be freely used as an alias for jQuery() throughout your code without issue.

    Any publicly distributed library that uses jQuery should be expected to do this as well to avoid conflicts with other code.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Lightbox
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic