Bug on js map ver 4.1

2104
18
12-09-2016 02:56 AM
LaxmanThapa
New Contributor II

When map isnot placed at the top of the page, the map has following bugs

  • The zoom on mouse wheel is not centered
  • The popup on map click does not position correctly. 

If I place the same map on the top of the page, then I do not have this bug.

Can someone help us solve this problem. Please click on the JSFiddle to see the bug.

Edit fiddle - JSFiddle 

Tags (1)
0 Kudos
18 Replies
RickeyFight
MVP Regular Contributor

Try removing the 

.box{
 height:400px;
 background:white;
 outline:2px solid red;
 }

from the css

0 Kudos
LaxmanThapa
New Contributor II

@Rickey That is the point. For me, the map needs to be somewhere in the middle. The 'box' is to show that there are some element like pictures, texts.

0 Kudos
ReneRubalcava
Frequent Contributor

Try absolute positions.

html, body {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
}

#viewDiv {
  position: absolute;
  top: 400px;
  bottom: 0;
  right: 0;
  left: 0;
}

.box{
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height:400px;
  background:white;
  outline:2px solid red;
}
0 Kudos
LaxmanThapa
New Contributor II

I cannot use absolute position because then I have to readjust the position of the map on every resize, device rotation etc etc... And I had tried it before, absolute positioning does not help. I wonder why simple thing like this is not working for esri map... 

0 Kudos
RickeyFight
MVP Regular Contributor

Why don't you just change the 400px to 50%? Will that work? 

html, body {
 padding: 0;
 margin: 0;
 height: 100%;
 width: 100%;
}
#viewDiv {
 position: absolute;
 top: 50%;
 bottom: 0;
 right: 0;
 left: 0;
}
.box{
 position: absolute;
 top: 0;
 left: 0;
 right: 0;
 height:50%;
 background:white;
 outline:2px solid red;
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
LaxmanThapa
New Contributor II

did you read my previous replies?.... 

0 Kudos
RickeyFight
MVP Regular Contributor

And when you use a % it puts the element relative to the screen...

width | CSS-Tricks 

0 Kudos
LaxmanThapa
New Contributor II

no @Rickey, you did not understand my point. I have updated the Fiddle to make it more understandable  Edit fiddle - JSFiddle 

http://prntscr.com/djm4x1 

0 Kudos
LaxmanThapa
New Contributor II

I have updated the Fiddle to make it more understandable  Edit fiddle - JSFiddle 

http://prntscr.com/djm4x1 

0 Kudos