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

  • Home
  • SEARCH
  • 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 7520729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:07:09+00:00 2026-05-30T02:07:09+00:00

I’m trying to make my first Chrome extension. Basically, the idea is to make

  • 0

I’m trying to make my first Chrome extension. Basically, the idea is to make a coloured filter that covers every page. (I have a monitor that won’t get any darker, so I want to put a translucent black filter over every site I visit.)

From my understanding, I can run javascript by using a “Content script,” with the script executing on every page. This is my manifest.json:

{
  "name": "My First Extension",
  "version": "1.0",
  "description": "The first extension that I made.",
  "browser_action": {
    "default_icon": "icon.png",
    "popup": "popup.html"
  },
    "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "css": ["mystyles.css"],
      "js": ["contentscript.js"]
    }
  ]
}

I want to do something like this: http://jsfiddle.net/GM2Z6/14/

Great, so I’ve gotten that far, by making mystyles.css like this:

#cover {
    height:100%;
    width:100%;
    background-color:#000;
    display:none;
    position:absolute;
    top:0;
    left:0;
    z-index:99999999;
}​

And I’ve got my contentscript.js looking like this:

$(function(){
    $('#cover').fadeTo("fast",0.5);
});​

So now how do I make my #cover div overlay on top of the page?

  • 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-30T02:07:10+00:00Added an answer on May 30, 2026 at 2:07 am

    A couple of things…As rvmook said, you didnt include jquery and you also never create the div in the page.

    Following is some code that works. Notice in the css I changed a couple of things…Position is now “fixed”, otherwise your div scrolls with the page and pointer-events:none; allows you to click through the div to the elements below it. Also now rely on the content scripts “run_at” option to decide when to run the script and not jquery, because I dont know what document_end is in jquery.
    manifest.json

    {
      "name": "My First Extension",
      "version": "1.0",
      "description": "The first extension that I made.",
      "browser_action": {
        "default_icon": "icon.png",
        "popup": "popup.html"
      },
        "content_scripts": [
        {
          "matches": ["<all_urls>"],
          "css": ["mystyles.css"],
          "js": ["jquery-1.7.1.min.js","contentscript.js"] ,
          "run_at" : "document_end"
        }
      ]
    }
    

    mystyles.css

    #cover {
        height:100%;
        width:100%;
        background-color:#000;
        display:none;
        position:fixed;
        top:0;
        left:0;
        z-index:99999999;
        pointer-events:none;
    }​
    

    contentscript.js

    (function(){
    
       $('<div/>', {
          id: 'cover'
       }).appendTo(document.documentElement);
    
        $('#cover').fadeTo("fast",0.5);
    
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.