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.

Javascript Won't Work for "All Pages"

2 posters

Go down

Solved Javascript Won't Work for "All Pages"

Post by Pendo 26th May 2018, 06:02

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 26th May 2018, 09:18; edited 1 time in total
Pendo
Pendo
Forumember

Male Posts : 217
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 26th May 2018, 08:04

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Pendo 26th May 2018, 08:15

SLGray wrote:Where did you get this JavaScript from?

Stackoverflow - Link to Question

It was put up by a ChrisF.
Pendo
Pendo
Forumember

Male Posts : 217
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 26th May 2018, 08:30



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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Pendo 26th May 2018, 08:58


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
Pendo
Forumember

Male Posts : 217
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 26th May 2018, 09:02

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Pendo 26th May 2018, 09:06

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
Pendo
Forumember

Male Posts : 217
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 26th May 2018, 09:07

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Pendo 26th May 2018, 09:08

SLGray wrote:Place it in all pages.

Done. Yes
Pendo
Pendo
Forumember

Male Posts : 217
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 26th May 2018, 09:13

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Pendo 26th May 2018, 09:18

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
Pendo
Forumember

Male Posts : 217
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 26th May 2018, 09:20

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

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