user3534516
user3534516

Reputation:

popup fixed it position

I am having a popup and it position is set dynamically according to the screen but when the number of the label increase the popup create problem as ones its show in upper side then when the label goes top on the scolling window it suppose to come down but its not coming down.

                 var position= popup.offsetTop;
                 alert("popupTop"+position);
                 var positionpop=popup.offsetHeight;   
                 var width1=label.offsetWidth;
                 var position1=label.offsetHeight;
                 var position2=label.offsetTop;         
                 var windowHeight = $wnd.innerHeight;
                 var scroll=$wnd.pageYOffset;
                 alert(scroll+"scroll");
                 var t=position-scroll;
                 var z=windowHeight-scroll;

                 var x="Totalheight"+screen.height; 
                 var y=position1+position2+positionpop;      
                 if(position1+position2+positionpop<windowHeight)
                 {
                    alert("no change");
                 }


                      if(position1+position2+positionpop>windowHeight )
                      { 
                       popup.setAttribute("style","top:"+(position2-positionpop)+"px");
                       } 

                 if(t<=0 || z<=0)
                 {

                   popup.setAttribute("style","bottom:"+(diff)+"px");
                 }

Upvotes: 0

Views: 401

Answers (2)

user3534516
user3534516

Reputation:

I have reached upto the dynamically changing the position up and down when the label is in the top but still have one problem that I both up and down position occured one by one I want to bound it into one..

                   if(position2+positionpop<windowHeight || t<=0)
                 {
                     popup.setAttribute("style","bottom:"+((windowHeight-(position2+position1))-positionpop)+"px");
                 }
                 else
                  {
                  if(position2+positionpop>windowHeight && t>0)
                  { 
                   popup.setAttribute("style","top:"+(position2-positionpop)+"px");
                  } 
                  }                                                                                                                                                                                                                                                                                                       

Upvotes: 1

vjrj
vjrj

Reputation: 121

You should use PopupPanel.setPopupPositionAndShow and PopupPanel.setPopupPosition. See the PopupPanel javadoc sample.

Upvotes: 0

Related Questions