P5 mouse click opens a link












-1















How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js



thanks










share|improve this question



























    -1















    How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js



    thanks










    share|improve this question

























      -1












      -1








      -1


      1






      How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js



      thanks










      share|improve this question














      How do I program moving to a new page after a mouse click without a hyperlink? I want to just draw a circle and if you click in the circle it takes you somewhere. I am working with P5.js



      thanks







      hyperlink p5.js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 '17 at 22:23









      scen hjordscen hjord

      113




      113
























          2 Answers
          2






          active

          oldest

          votes


















          0














          your_circle.mouseClicked(window.open('http://your-link.com'))



          Reference:




          1. mouseClicked()

          2. window.open()






          share|improve this answer

































            -1














            Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.



            You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.



            For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.



            Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.



            When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42963752%2fp5-mouse-click-opens-a-link%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              your_circle.mouseClicked(window.open('http://your-link.com'))



              Reference:




              1. mouseClicked()

              2. window.open()






              share|improve this answer






























                0














                your_circle.mouseClicked(window.open('http://your-link.com'))



                Reference:




                1. mouseClicked()

                2. window.open()






                share|improve this answer




























                  0












                  0








                  0







                  your_circle.mouseClicked(window.open('http://your-link.com'))



                  Reference:




                  1. mouseClicked()

                  2. window.open()






                  share|improve this answer















                  your_circle.mouseClicked(window.open('http://your-link.com'))



                  Reference:




                  1. mouseClicked()

                  2. window.open()







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 29 '18 at 4:30

























                  answered Dec 29 '18 at 2:24









                  Lucas LopesLucas Lopes

                  19614




                  19614

























                      -1














                      Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.



                      You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.



                      For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.



                      Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.



                      When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.






                      share|improve this answer






























                        -1














                        Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.



                        You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.



                        For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.



                        Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.



                        When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.






                        share|improve this answer




























                          -1












                          -1








                          -1







                          Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.



                          You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.



                          For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.



                          Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.



                          When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.






                          share|improve this answer















                          Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense.



                          You have to split your problem up into smaller pieces. Then take on each of those smaller steps one at a time.



                          For example, step one might be creating a program that draws a circle. Now detect when the mouse clicks inside that circle. Don't worry about the link yet. Just print something to the console whenever the user clicks the circle.



                          Step two might be creating a program that opens a link when the user clicks anywhere in the sketch. Don't worry about the circle yet. Googling "JavaScript navigate to new page" or something like that would yield a ton of results.



                          When you get each of them working perfectly, then you can think about combining them into a single program. And if you get stuck on a specific step, post a MCVE along with a specific question, and we'll go from there. Good luck.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited May 23 '17 at 12:10









                          Community

                          11




                          11










                          answered Mar 23 '17 at 2:10









                          Kevin WorkmanKevin Workman

                          33.7k53969




                          33.7k53969






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42963752%2fp5-mouse-click-opens-a-link%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Monofisismo

                              Angular Downloading a file using contenturl with Basic Authentication

                              Olmecas