Jump to content

JamesL

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by JamesL

  1. Yes, it is possible. But you need to add some more Javascript to handle this.

    Break it down to smaller tasks:

    1. Click link to open window and set an event listener to monitor the popup window

    2. Popup window also checks to see if it has focus. If not, it sets focus and brings itself to the front.

    3. The 'opener' window monitors to see if the popup has focus. If the user clicks on the opener (anywhere but the link), it should return focus to the popup.

    4. The only exception is if the user clicks on the link from the opener window. If they do click it, an event listener is triggered, and closes the popup window.

     

  2. If you have multiple IDs in a document, the browser will set the value to the last one.

    For example:

    <a id="link" href="https://google.com">Google</a>
    
    <a id="link" href="https://yahoo.com">Yahoo</a>
    
    <a id="link" href="https://ebay.com">eBay</a>

    In this case, the href value of the id 'link' will be 'https://ebay.com'.

    The other two are replaced by the last value.

    Can you do it? Sure.

    Does it help you? Not one bit.

    It doesn't cause your browser to self-destruct or anything. But, you can't write functional Javascript code.

     

  3. There are probably "media queries" (https://www.w3schools.com/css/css_rwd_mediaqueries.asp ) which alter the content based on the screensize.

    You have to figure out:

    1. What your screen viewport size is (window.innerHeight + window.innerWidth)

    2. Determine which stylesheet is being used based on the screen size (e.g. small.css, medium.css, large.css)

    3. Figure out if the element is being hidden by the CSS (e.g. "visibility:hidden' or 'display:none')

  4. You would need to rename your existing files to something different. (Or, you could rename the new files).

    In the end you would have something like this:

    <!DOCTYPE html>
    <html>
      <head>
        <title>Your site</title>
        <!-- the existing stylesheet -->
        <link rel="stylesheet" href="stylesheet1.css">
        <!-- the new stylesheet -->
        <link rel="stylesheet" href="stylesheet2.css">
        <!-- your existing javascript -->
        <script src="oldjavascript.js"></script>
        <!-- your new javascript -->
        <script src="newjavascript.js"></script>
      </head>
      <body>
        
      </body>
    </html>

     

  5. Come up with a list of requirements.

    Must do these things:

    • A
    • B
    • C
    • D

    Would like to also do these things (if possible)

    • A
    • B
    • C

    Keep each bullet point one sentence or less (easy to read and understand by other people).

    This is your 'requirements' document.

    All of the things you described can easily be done with HTML / Javascript / CSS.

    WordPress just makes it more complicated.

     

×
×
  • Create New...