This is the day in the group to hear someone do this function, thus generating interest. Also want to try, referring to the KK on GitHub example Https://github.com/kunkun12/MapSwipe, the example is written in detail, I do not repeat here. Look first:
In fact, the principle is very simple, is to set the second add in the layer of the div container width and height.
Here's what I learned from the small experience: in the above there are 2 radio button buttons, we choose the horizontal roller shutter or vertical shutter, we have to make a judgment on this button, here cleverly used in this way
var isverticalswipe=false; var ishorizontalswipe=false; On (Dom.byid (' verticalswipe '), "click",function() { isverticalswipe=! Isverticalswipe; Not set to true, but a=!a; very ingenious }); On (Dom.byid (' horizontalswipe '), "click",function() { ishorizontalswipe=! ishorizontalswipe; });
The source code can be downloaded from the connection to GitHub above.
The ArcGIS for JavaScript API implements the map swipe effect