This project is archived and is in readonly mode.

#67 ✓hold
Constantine Zykov

overtext and window.scroll

Reported by Constantine Zykov | June 2nd, 2009 @ 05:26 AM | in backlog (closed)

I offer to do some changes in OverText, cause it has unexpected behavior when page scrolled (when page loaded in a middle at a#href, and OverText is somewhere in top of page):

attach: function() {
.. window.addEvent('resize', this.reposition.bind(this)); window.addEvent('scroll', this.reposition.bind(this)); .. }

reposition: function() {
if (this.text.isDisplayed()) { try {

this.assert();
if (!this.element.getParent() || !this.element.offsetHeight) return this.hide();
if (this.test()) this.text.position($merge(this.options.positionOptions, { relativeTo: this.element }));
} catch (e) { }

} return this; }

Comments and changes to this ticket

  • Aaron Newton

    Aaron Newton June 2nd, 2009 @ 09:27 PM

    • Milestone set to backlog
    • State changed from “new” to “hold”
    • Assigned user set to “Aaron Newton”

    can you elaborate on what you're trying to fix here? Can you post a link to a page that reproduces the problem?

  • Constantine Zykov

    Constantine Zykov June 3rd, 2009 @ 03:13 AM

    No I don't have link yet.

    I'll try to explain:

    1. Inputs in header at the top of page.
    2. OverText attached to inputs.
    3. Page loads by link http://site/page.php#anchor, that loads page in such way that inputs are not visible (page is scrolled to the middle)

    Now the problems:
    1. If you scroll page so you can see inputs, OverText will be in wrong position. I fixed this with:

    attach: function() {
    ..
      window.addEvent('resize', this.reposition.bind(this));
      window.addEvent('scroll', this.reposition.bind(this));
    ..
    }
    
    2. If you set focus to input by input.focus(), OverText shouldn't be shown. In fact when page scrolled to the inputs OverText that should be hidden is shown together with cursor and in wrong position. I fixed this with:
    reposition: function() {
      if (this.text.isDisplayed()) {

    try {
      this.assert();
      if (!this.element.getParent() || !this.element.offsetHeight) return this.hide();
      if (this.test()) 
        this.text.position($merge(this.options.positionOptions, { relativeTo: this.element }));
    }
    catch (e) { }
    
    
    
    
    } return this; }
  • Constantine Zykov

    Constantine Zykov June 3rd, 2009 @ 03:33 AM

    Before input.focus() I do inputOverText.hide().

    All that is about IE7.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Tags

Pages