Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member mhookem's Avatar
    Join Date
    May 2012
    Location
    Chesterfield, Derbyshire. United Kingdom
    Posts
    47
    Member #
    31766
    <canvas id='pic' style="position:absolute; left:30px; top:50px; z-index:60;">
    </canvas>
    <script type="text/javascript">
    var q=document.getElementById("pic");
    var qtx=q.getContext("2d");
    var img=new Image();
    img.onload=function(){
    qtx.drawImage(img,0,0,45,45);
    }
    img.src="../images/Help.png";
    </script>

    Ok. Can someone show me how to make the image clickable?

    i.e. <a href ="#help"><img src="images/mylmg.png"/></a>

    This would be the usual way not putting the canvas into the equation.
    I've tried a couple of things but no luck.

    Any suggestions would be greatly appreciated.

  2.  

  3. #2
    Member mhookem's Avatar
    Join Date
    May 2012
    Location
    Chesterfield, Derbyshire. United Kingdom
    Posts
    47
    Member #
    31766
    Ok! Five minutes later and I've almost solved it!

    pic.onClick = function(){
    parent.location ='#help';
    }

    This works but...

    There's no hand when you hover the mouse over it to show that it's a link.......mmmmmm.....

    *edit. Problem solved. putting cursor: pointer in the canvas style attributes has done the trick.

  4. #3
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    Quote Originally Posted by mhookem, post: 237596
    Ok! Five minutes later and I've almost solved it!

    pic.onClick = function(){
    parent.location ='#help';
    }

    This works but...

    There's no hand when you hover the mouse over it to show that it's a link.......mmmmmm.....

    *edit. Problem solved. putting cursor: pointer in the canvas style attributes has done the trick.
    Thanks for posting the solution - it may help someone else.
    m3n0tu18 likes this.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

canvas drawimage memory

,
canvas html5 drawimage memory leak
,

canvas image link

,
drawimage clickable html5 javascript
Click on a term to search for related topics.
All times are GMT -6. The time now is 09:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com