Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I access separate points/sections on a single image in html/javascript?
    primarykey
    data
    text
    <p>I am learning to develop mobile applications, quite in the initial phase.</p> <p>This query is not related to mobile but more to html/css/js.(for </p> <p>I intend to make a simple game, where a picture is seen, a few options are available and the user can drag and drop these options onto the image. eg. There is an image of a plant > options are #leaf #stem #flower #bud The user must drag and drop the correct option to the correct place on the image to get points. i.e Drag the #leaf option onto the leaf of the plant.</p> <p>Now my problem is the image, the separation of these points, I can't figure out how to do it.</p> <p><strong>Query in short: How do I access separate points/sections on a single image in html/js for above purpose?</strong></p> <p><strong>Query (longer version)</strong> I did a little search and realised I can slice the image and recreate it using multiple images, I tried this, it sort of works but it has a a lot of drawbacks:</p> <p>1)More images mean more space, combined size of the split images was about 1.5x the original image(this is just splitting it into 4 images)</p> <p>2)For a complex picture, the number of images to slice into is large and hard to manage in css(n00b==me) as they don't just need to be split into a simple X*Y grid but a much more complex split depending on the object in the image.(realised when I was trying to do a simple cell structure img)</p> <p>3)More images also means more http requests(in case the app is WebView based) which will increase loading time.</p> <p>It just seemed liked too much of a hassle, there must be a better way.</p> <p>Then I saw css sprites , I dont need to combine my images like sprites are intended for, rather the reverse. Just access parts of my pre-existing image, as separate objects.I haven't tried this(working on it) and and I haven't seen this being done either, or maybe its being done and I'm not seeing.</p> <p>Please help guys, my problem is quite simple(I think) , I think I'm just not getting the correct google search terms.</p> <p>If anybody has any ideas,links, resources and also any clarifications as I may not have put up my problem as clearly as I'd like to, please do reply.</p> <p>regards, Rahul Agarwal</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload