开发者

set a div image on another div image asp.net

开发者 https://www.devze.com 2023-04-07 04:22 出处:网络
Would it be possible to set a div image over another div image in asp.net? For example: after having an image A, the user chooses an image B with location 10, 10 then the 开发者_如何学Goimage B will

Would it be possible to set a div image over another div image in asp.net?

For example: after having an image A, the user chooses an image B with location 10, 10 then the 开发者_如何学Goimage B will be placed at location 10, 10 on the image A (not merging).

Or it is required to use jQuery?

Thanks in advance.


I assume that you are running Web Forms.

You can accomplish this by wrapping the images in a position relative div and then position them absolute, you can do this from the code behind.

Here is the HTML + CSS to demonstrate this: http://jsfiddle.net/GuafM/

The serverside code to add the dot would look something like this:

Image imgDot = new Image();
imgDot.ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/6/6e/Paris_plan_pointer_b_jms.gif";
imgDot.Style["top"] = "10px";
imgDot.Style["left"] = "10px";

divImageWrapper.Controls.Add(imgDot);

If you want the user to drag and drop (or similar complex client side behaviour) a image on top of another I would probably recommend that you use jQuery.

0

精彩评论

暂无评论...
验证码 换一张
取 消