Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - jquery co-ordinate problems on an image with in a absolute positioned div -


i have problem recording x , y co-ordinates using jquery/javascript, on image in 'position: absolute div' container.

basically supposed happen somewhere in image clicked, , div containing information placed on co-ordinates.

however when image's div container has position absolute, x , y co-ordinates off, needs there overlay image on divs, unless can think of better way?

below code, appreciated

<style>     #image_container {position: absolute}     #test_img {}     .image_dot { height: 5px; width: 5px; background-color: red; position: absolute; } </style>  <div id="image_container">     <img src="mrt.jpg" id="test_img" />  </div> <script type="text/javascript">       $("#test_img").click(function(event) {         var x = event.pagex - this.offsetleft;         var y = event.pagey - this.offsettop;         $("#image_container").append('<div class="image_dot" id="uniqueid" style="display: none;">some text</div>');         $("#unqiueid").css("top",x+"px").css("left",y+"px").show();     }); </script> 

i'm not sure if work since don't have time set test-case, think if possible should let click() event bubble body element. example:

$(body).click(function(e) {     var x = event.pagex;     var y = event.pagey;     $("body").append('<div class="image_dot" id="uniqueid" style="display: none;">some text</div>');     $("#unqiueid").css("top",x+"px").css("left",y+"px").show(); } 

if being positioned absolute anyway (and not relative), shouldn't matter, , believe should better pagex , pagey values using body (or maybe window?) element.

as said, though, haven't had chance test this. let me know if works!


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -