How to find a particular position on every screen?
I want to find coordinates of a particular windows screen portion. I have to pass these as parameter to some JavaScript function. This function will display a tool-tip div on a particular position of page ( 2 inch above bottom right corner) no matt开发者_如何学Goer what resolution or screen size or browser a visitor may have.
For demonstration please see this link http://www.dhtmlgoodies.com/submitted-scripts/title-to-note/title-to-note.html
<div style="position:absolute; bottom: 2in; right: 0px;">test</div>
EDIT:
$(document).ready(function() {
var height = $(window).height();
var width = $(window).width();
alert('width: '+width+'; heigth: '+height);
});
now to position your div, you'll just need to absolute position your div
top:height - div height - 2 inches.
left: width - div width
.tooltip {position: absolute; bottom: 40px; right: 40px;}
.page-wrapper {position: relative;}
<div class="page-wrapper">
//website content
</div>
<div class="tooltip">
//tooltip content
</div>
精彩评论