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 7077587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:26:32+00:00 2026-05-28T06:26:32+00:00

Say you have a 50px by 50px div/box <div style=width: 50px; height: 50px;> </div>

  • 0

Say you have a 50px by 50px div/box

<div style="width: 50px; height: 50px;">
</div>

In this box you want to have two links that bisect it diagonally like so

Bisect

You could use the old map/area HTML but that’s undesirable since jquery doesn’t play very nicely with it… but that’s another story.

I’m short of ideas and would really appreciate help/insight on how would you approach this situation.

  • 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-28T06:26:33+00:00Added an answer on May 28, 2026 at 6:26 am

    This is very simple with jQuery, especially since it is a simple y=x split:

    $("#clickMe").click(function(event){
        console.log(event);
        if(event.offsetX>event.offsetY){
            parent.window.location="http://bing.com";
        }else{
            parent.window.location = "http://google.com";   
        }
    });
    

    What we’re doing is detecting the region in the div based on a y=x function (any function would work though). By the way, I’m using parent for jsfiddle only because the code runs in an iframe.

    http://jsfiddle.net/JM6JC/4/

    [UPDATE]

    Ok, you asked about how to do a line going in the opposite direction. I think it’d be better to generalize this a bit. The question is nothing but an inequality, which you should remember from grade school math [more or less :)]. If not, here’s a video:
    http://www.khanacademy.org/video/graphing-inequalities?playlist=ck12.org+Algebra+1+Examples

    I’ve made an updated demonstration that has an “isAboveFunction” function. It’s dead simple: it passes in X,Y coordinates, performs a function (in the algebraic sense) on X, and figures out if the result is greater than Y. In all the regions that it IS greater, we can shade that region and apply some different logic.

    Also remember that in computer coordinates, X and Y start from the top left of your screen. X (sometimes called “left”) is how far from the left side of your screen (or in this case how far from the left side of a box. Similarly, Y (or “top”) is how far down from the top.

    Put these two concepts together and you can make any function you want. I have included some examples but feel free to play around with it:

    function isAboveFunction(x,y){
        var line;
        //CHANGE ME
        //line=x*x*.025;
        //line= 2*x;
        //line = -1*x+50;
        line= 200/x;
    
        if(y>line){
           return true;
        }else{
             return false;   
        }
    }
    

    http://jsfiddle.net/JM6JC/33/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So let's say have the following content structure: <div class=wrapper> <div class=contentOne style=width:50px></div> <div
Say I have a class named testThing: .testThing { background-color:#000000; float:left; height:50px; width:50px; }
Say I have a .box class in CSS: .box { height: 50px; } Now,
let say have element like this <div class=watch-me style=display: none;>Watch Me Please</div> as we
I have a div with height 50px that contains a child div. The height
Say I have a select box eg <div data-bind='visible: someProp'> <select class=selectSubWidgets data-bind='options: subWidgets,optionsText:
Say we have two pointers to objects that can contain a property equal and
Say I have a 200x200 image. Then say I want to have a box
Say have a linear model LM that I want a qq plot of the
Let's say I have the following markup: <li style=width: 200px;> <a href=....> <img style=width:

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.