-
19 Aug 2010 7:50 AM #1
Unanswered: position panel based on page scrolling
Unanswered: position panel based on page scrolling
Hi everybody!
I've a problem: I would create a panel or a window that follows the page scrolling. When I scroll down the page, the panel position goes down with the scroll, when I scroll up the page, the panel position goes up....How can obtain this effect?
Thanks!!
-
19 Aug 2010 8:16 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
- Answers
- 1
You could use:
Code:var w = new Ext.Window({ title: 'Hello', x: 100, y: 100, width: 200, height: 100 }).show(); Ext.EventManager.on(window, 'scroll', function(){ w.setPosition(window.scrollX + 100, window.scrollY + 100); });
-
19 Aug 2010 11:59 PM #3
thank you so much condor!

I've already tried something similar, but I'm not be able to "bind" the window inside a div: I tried with the 'renderTo' config, but it doesn't work. I think the problem is in the x, y settings. My div is on the right of the page, instead now it appears on the left (I think because of x,y = 100):
Can you help me?Code:var win = new Ext.Window({ title: 'Shop cart', id: 'schopcart', width: 200, autoHeight: true, closable: false, collapsible: true, draggable: false, monitorResize: true, renderTo: 'containerColRightSide' }); win.show(); Ext.EventManager.on(window, 'scroll', function(){ win.setPosition(window.scrollX + 100, window.scrollY + 100); });
-
20 Aug 2010 12:22 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
- Answers
- 1
You will have to use:
Code:win.setPosition(window.scrollX + Ext.lib.Dom.getViewWidth() - 200, window.scrollY + ???);
-
20 Aug 2010 12:42 AM #5
Using this code:
the problem is that vertical scroll doesn't work, instead horizontal scroll moves the shop cart window more and more on the rightCode:var win = new Ext.Window({ title: 'Carrello', id: 'carrello', width: 200, autoHeight: true, closable: false, collapsible: true, draggable: false, monitorResize: true, renderTo: 'containerColRightSide' }); win.show(); Ext.EventManager.on(window, 'scroll', function(){ win.setPosition(window.scrollX + Ext.lib.Dom.getViewWidth() - 200, window.scrollY + 100); });
I've tried this solution:
and vertical scroll works again, but if I resize my web page the shop cart window moves in the center of the page. Probably I should use something that returns a X position proportional to the page dimension, right?Code:var win = new Ext.Window({ title: 'Carrello', id: 'carrello', width: 200, autoHeight: true, closable: false, collapsible: true, draggable: false, monitorResize: true, renderTo: 'containerColRightSide' }); win.show(); Ext.EventManager.on(window, 'scroll', function(){ win.setPosition(Ext.lib.Dom.getViewWidth() - 700, window.scrollY + 100); });
Similar Threads
-
How to get position of element in Panel relative to page?
By dbassett74 in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 18 Nov 2009, 12:47 PM -
Widget position based on Own CSS
By dhanabalan in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 26 Apr 2009, 10:15 PM -
how to record and then restore a scrolling position at scrollbar for a panel
By mxu in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 14 Mar 2008, 6:57 AM


Reply With Quote