Javascript Won't Work for "All Pages" Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
2 posters

    Javascript Won't Work for "All Pages"

    Pendo
    Pendo
    Forumember


    Male Posts : 217
    Reputation : 13
    Language : English
    Location : USA

    Solved Javascript Won't Work for "All Pages"

    Post by Pendo May 26th 2018, 6:02 am

    I'm using a Javascript code to let me style tooltips on my forum. It works fine if I select any, or all, of the individual placement options but if I try to select "In all the pages", it suddenly stops working on any page.

    The code is below:
    Code:
    (function () {
        var ID = "tooltip", CLS_ON = "tooltip_ON", FOLLOW = true,
        DATA = "_tooltip", OFFSET_X = 20, OFFSET_Y = 10,
        showAt = function (e) {
            var ntop = e.pageY + OFFSET_Y, nleft = e.pageX + OFFSET_X;
            $("#" + ID).html($(e.target).data(DATA)).css({
                position: "absolute", top: ntop, left: nleft
            }).show();
        };
        $(document).on("mouseenter", "*[title]", function (e) {
            $(this).data(DATA, $(this).attr("title"));
            $(this).removeAttr("title").addClass(CLS_ON);
            $("<div id='" + ID + "' />").appendTo("body");
            showAt(e);
        });
        $(document).on("mouseleave", "." + CLS_ON, function (e) {
            $(this).attr("title", $(this).data(DATA)).removeClass(CLS_ON);
            $("#" + ID).remove();
        });
        if (FOLLOW) { $(document).on("mousemove", "." + CLS_ON, showAt); }
    }());

    Link to Site

    Thank you for your help!


    Last edited by Pendo on May 26th 2018, 9:18 am; edited 1 time in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51517
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Javascript Won't Work for "All Pages"

    Post by SLGray May 26th 2018, 8:04 am

    Where did you get this JavaScript from?



    Javascript Won't Work for "All Pages" Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Pendo
    Pendo
    Forumember


    Male Posts : 217
    Reputation : 13
    Language : English
    Location : USA

    Solved Re: Javascript Won't Work for "All Pages"

    Post by Pendo May 26th 2018, 8:15 am

    SLGray wrote:Where did you get this JavaScript from?

    Stackoverflow - Link to Question

    It was put up by a ChrisF.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51517
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Javascript Won't Work for "All Pages"

    Post by SLGray May 26th 2018, 8:30 am




    Javascript Won't Work for "All Pages" Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Pendo
    Pendo
    Forumember


    Male Posts : 217
    Reputation : 13
    Language : English
    Location : USA

    Solved Re: Javascript Won't Work for "All Pages"

    Post by Pendo May 26th 2018, 8:58 am


    I tried it (and actually think I prefer it) but I'm having the same problem as the other code. It works when I individually select pages for it to work on, but it doesn't work at all when I select all pages. Think
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51517
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Javascript Won't Work for "All Pages"

    Post by SLGray May 26th 2018, 9:02 am

    Post a link to a place that contains something that has a tooltip so we an see the code in action.



    Javascript Won't Work for "All Pages" Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Pendo
    Pendo
    Forumember


    Male Posts : 217
    Reputation : 13
    Language : English
    Location : USA

    Solved Re: Javascript Won't Work for "All Pages"

    Post by Pendo May 26th 2018, 9:06 am

    SLGray wrote:Post a link to a place that contains something that has a tooltip so we an see the code in action.

    Well, I enabled it in all of the individual sections just now so you can see it if you hover over any of the navigation menu options on the Homepage. The problem is, if I do it this way then the code doesn't work on pages that aren't expressly listed, creating inconsistencies.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51517
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Javascript Won't Work for "All Pages"

    Post by SLGray May 26th 2018, 9:07 am

    Place it in all pages.



    Javascript Won't Work for "All Pages" Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Pendo
    Pendo
    Forumember


    Male Posts : 217
    Reputation : 13
    Language : English
    Location : USA

    Solved Re: Javascript Won't Work for "All Pages"

    Post by Pendo May 26th 2018, 9:08 am

    SLGray wrote:Place it in all pages.

    Done. Yes
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51517
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Javascript Won't Work for "All Pages"

    Post by SLGray May 26th 2018, 9:13 am

    You do only have the in all pages box checked, correct?



    Javascript Won't Work for "All Pages" Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Pendo
    Pendo
    Forumember


    Male Posts : 217
    Reputation : 13
    Language : English
    Location : USA

    Solved Re: Javascript Won't Work for "All Pages"

    Post by Pendo May 26th 2018, 9:18 am

    SLGray wrote:You do only have the in all pages box checked, correct?

    Yes, but I actually just fixed it. :party:

    I found a piece of the code for my widget tabs were returning an error that also included the tooltips code, for whatever reason. I removed that part of the other code and now the tooltip code is working for all pages. Very Happy

    Thank you! #Solved
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51517
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Javascript Won't Work for "All Pages"

    Post by SLGray May 26th 2018, 9:20 am

    Thanks for posting the solution.
    Problem solved & topic archived.
    Please read our forum rules:  ESF General Rules



    Javascript Won't Work for "All Pages" Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.