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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:19:01+00:00 2026-06-02T05:19:01+00:00

My code is below. I also have it at http://jsfiddle.net/S2JHa/ I do not understand

  • 0

My code is below. I also have it at http://jsfiddle.net/S2JHa/

I do not understand why cursor changes to I-beam when I click and drag the mouse over my picture.

If I remove “some text” then it does not change. This happens in Chrome. FF is fine.

Please if you can tell how to fix that I would appreciate it.
Thanks!

<div id="window">
    <div>some text</div>
  <div id="sketch" class="box">
    <div class="contents">
      <canvas id="image-layer"></canvas>
    </div>
  </div>
</div>
​

CSS:

#window #sketch
{
    padding: 1cm 0;
}
#window #sketch canvas
{
    left: 0;
    position: absolute;
    top: 0;
}
#window #sketch .contents
{
    cursor: crosshair;
    position: relative;
}
div.box
{
    background-color: #fff;
    border: 1px solid black;
    border-radius: 0.3cm;
    cursor: move;
    left: 0;
    position: fixed;
    top: 0;
}
​

JavaScript:

function image_onload(e) {
    var image = e.target;

    $("div.box").draggable({
        cancel: "div.box div.contents",
        containment: "document"
    });

    var x = $("#window #sketch");

    // size to fit image
    x.css("width", image.width);
    x.css("height", image.height);

    // center sketch inside parent window
    x.css("left", ($(window).width() - x.width()) / 2);

    var canvas = document.getElementById("image-layer");

    canvas.height = image.height;
    canvas.width = image.width;

    var context = canvas.getContext("2d");
    context.drawImage(image, 0, 0);
}

function open(url) {
    var image = new Image();

    image.src = url;
    image.onload = image_onload;
}

open("http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png");
  • 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-06-02T05:19:02+00:00Added an answer on June 2, 2026 at 5:19 am

    If you don’t want interactivity with the canvas you can cancel the onmousedown event like so:

    canvas.onmousedown = function () {
        return false;
    }
    

    Fr IE you will need:

    canvas.onselectstart = function () { 
        return false;
    }
    

    See updated jsfiddle here: http://jsfiddle.net/S2JHa/11/

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

Sidebar

Related Questions

I have a jsfiddle below: http://jsfiddle.net/Jsh2V/10/ The first sets of test buttons (show it
I have the below code that does not seem to work at all :(
I have tried to do this here http://wonderfl.net/c/9Kdv but what I want is not
I've put together a small code-sample below (Currently in C# 3.5 but would also
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design
Code below is working well as long as I have class ClassSameAssembly in same
The code below gives an error: Property 'Int32 Key' is not defined for type
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have
I have the code as per below. This retrieves some data to use for

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.