Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6902367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:47:21+00:00 2026-05-27T07:47:21+00:00

You know how those pop up advertisements work? the ones that are super annoying

  • 0

You know how those pop up advertisements work? the ones that are super annoying when you hover over them. I want to create something similar.

What I want to do is given specific per-determined words with a given “definition” associated with those words, like a key value pair, search my web page for those words then make those words if clicked on pop up a little tooltip giving that words definition, the value.

Now I can kinda piece this together but I want to do it the most efficient way with caching the dictionary and caching as much as possible. so I don’t have to create two arrays every time the page loads then check if the words on the page match anything in the dictionary and if so make a tooltip or little pop up.

Can anyone give me any ideas or even code hints/links to help me get the best results/load times so It doesn’t take forever every time the web page loads.

I haven’t started making any of it yet, so I can go any route, I just want it to be fast.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:47:22+00:00Added an answer on May 27, 2026 at 7:47 am

    Take your text container element and split(' ') it’s content by words. Iterate over this array of words and wrap those of the words that are in the dictionary with a span or some other element. Then, join(' ') the array back and replace the container’s innerHTML with it.

    Next, add a listener to the container with a handler that will react only if e.target is a span.

    container.addEventListenter('click', function (e) {
        if ('SPAN' === e.target.tagName) {
            lookUpWord(e.target)
        }
    }, false)
    

    The function lookUpWord will analyze the span‘s text and draw the looked up definition.

    As for the format of the dictionary, it’d better be a simple JSON object, like this one:

    var dictionary = {
        "astrolabe": "An astronomical and navigational instrument for gauging the altitude of the Sun and stars.",
        "logarithm": "For a number x, the power to which a given base number must be raised in order to obtain x.",
        "Darth Vader": "Lover, warrior, Dark Lord of the Sith."
    }
    

    A lookup in such an object would be as trivial as:

     var word = 'Darth Vader'
     var definition = dictionary[word]
    

    To check if a word is in the dictionary:

    if (word in dictionary) { /* ... */ }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You know those websites that let you type in your checking account number and
I don't know which of those three methods suits me most. They all work
I know that detecting scrollbar presence is supposed to be one of those elusive
Does anybody know where I could find WinForms controls that mimic those on the
I'm trying to create a pop up box (with jQuery) that can handle forms,
You know those 300mb gameloft games? They usually come as very small apk files
You know how those packed js files look like, right? eval(function(p,a,c,k,e,d){ ... } ('obfuscated-string'.split('|'),0,{}))
I'd like to write a basic socket chat app, except encrypted. Y'know all those
Here comes a simple question, for all those who know javascript. I made an
To recap for those .NET gurus who might not know the Java API: ConcurrentHashMap

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.