Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3573 (closed enhancement: wontfix)

Opened 4 years ago

Last modified 3 years ago

window visibleWidth/Height

Reported by: matthias <matthias@knallgrau.at> Assigned to: sam@
Priority: normal Milestone:
Component: Prototype Version: 1.0.0
Severity: normal Keywords:
Cc:

Description

i had the need to get the visible window width & height. (to ensure an element won't be positioned outside this range)

getting these values depends heaviliy on the browser you are using. so i added two attributes to Position, which get initialized on Position.prepare (in most cases you need this you will call Position.prepare anyway, because you need also scrollX/Y, resp. deltaX/Y)

maybe that is also useful for others and makes it into prototype.js

!!! i haven't (couln't) test it on Safari.

var Position = {
  // ...
  prepare: function() {
    // ...
    this.visibleWidth = 
        (window.opera) ? document.body.clientWidth || document.documentElement.clientWidth || window.innerWidth
        : document.documentElement.clientWidth || window.innerWidth || document.body.clientWidth;
    this.visibleHeight = 
        (window.opera) ? document.body.clientHeight || document.documentElement.clientHeight || window.innerHeight
        : document.documentElement.clientHeight || window.innerHeight || document.body.clientHeight;
    // ...

Attachments

prototype.js (46.3 kB) - added by haruta@kyokutyo.com on 03/21/06 10:32:06.

Change History

02/12/06 06:41:27 changed by matrix9180@gmail.com

  • component changed from ActiveRecord to Prototype.

03/21/06 10:32:06 changed by haruta@kyokutyo.com

  • attachment prototype.js added.

05/23/07 19:29:25 changed by josh

  • status changed from new to closed.
  • resolution set to wontfix.