Javascript Won't Work for "All Pages"

Go down

Solved Javascript Won't Work for "All Pages"

Post by Pendo on 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

Pendo
Forumember

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

http://lorecraft.forumotion.com/

Back to top Go down

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

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

Where did you get this JavaScript from?



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

Male Posts : 44345
Reputation : 3144
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

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

Post by Pendo on 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.

Pendo
Forumember

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

http://lorecraft.forumotion.com/

Back to top Go down

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

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




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

Male Posts : 44345
Reputation : 3144
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

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

Post by Pendo on 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

Pendo
Forumember

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

http://lorecraft.forumotion.com/

Back to top Go down

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

Post by SLGray on 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.



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

Male Posts : 44345
Reputation : 3144
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

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

Post by Pendo on 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.

Pendo
Forumember

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

http://lorecraft.forumotion.com/

Back to top Go down

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

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

Place it in all pages.



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

Male Posts : 44345
Reputation : 3144
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

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

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

@SLGray wrote:Place it in all pages.

Done. Yes

Pendo
Forumember

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

http://lorecraft.forumotion.com/

Back to top Go down

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

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

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



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

Male Posts : 44345
Reputation : 3144
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

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

Post by Pendo on 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

Pendo
Forumember

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

http://lorecraft.forumotion.com/

Back to top Go down

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

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

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



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

Male Posts : 44345
Reputation : 3144
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum