0

I am using a tooltip edit script that includes the following:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="http://static.tumblr.com/iuw14ew/VSQma1786/jquery.style-my-tooltips.js"></script>

<script>
    (function($){
        $(document).ready(function(){
            $("a[title]").style_my_tooltips({
                tip_follows_cursor: true,
                tip_delay_time: 90,
                tip_fade_speed: 600,
                attribute: "title"
            });
        });
    })(jQuery);
</script>

But, due to another script I am using, I need to use this version of jQuery:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

Trying to use the 2.1.4 breaks the tooltips style. Help? I am super super new to jQuery and Javascript.

Berry M.
  • 469
  • 1
  • 4
  • 17
Elli OHare
  • 11
  • 2
  • You can use two jquery version. Read this: https://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page?answertab=active#tab-top – Ali Hesari Jun 08 '17 at 04:19
  • So, I don't know enough javascript or jQuery to understand anything that's going on with that link...Like I said I'm super new. – Elli OHare Jun 08 '17 at 05:03

1 Answers1

0

As @Ali said in his comment, you can use jQuery's noConflict function.

By default, jQuery uses $ as a shorthand function name. Using jQuery.noConflict() you can bind this to something else.

This means, as shown in the linked answer, you can do the following:

For version 1.7, you can do the following:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript"> var jQ = $.noConflict(true); </script>

Now, instead of $(document).ready() you can use jQ(document).ready() to access jQuery 1.7 functions.

jQuery 2.1.4 will still be accessible through $.

Do note that jQuery 1.7 is 6 years old, and might be obsolete. Consider looking for a more up-to-date version of the Tooltip library you're using.

Bootstrap has the functionality you're looking for!

Berry M.
  • 469
  • 1
  • 4
  • 17