Select to view content in your preferred language

Layer Swipe... initial position of swipeDiv

936
4
Jump to solution
10-02-2013 01:06 PM
NickO_Day
Occasional Contributor
What is the best way to control the initial position of the swipeDiv in the Layer Swipe example?  I'd like to have our streets basemap displayed first (and fully) when a user opens the app, but then give them the option of seeing both basemaps (streets and imagery) after the app loads.  Setting the position of swipeDiv via CSS doesn't seem to work, nor does it seem like the smart thing to do since it's controlling other divs.
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Deactivated User
0 Kudos
4 Replies
derekswingley1
Deactivated User
Have you tried using the top and/or left constructor options? https://developers.arcgis.com/en/javascript/jsapi/layerswipe-amd.html#layerswipe1
0 Kudos
MattDriscoll
Esri Contributor
Yes, use the "left" property. You could modify the left property CSS on the handle and call widget.swipe() as well.
0 Kudos
NickO_Day
Occasional Contributor
Yes!  The
left: 1
property does exactly what I needed.  FYI to all:  you can't set this to 0.
Thanks Derek and Matt!
0 Kudos
MattDriscoll
Esri Contributor
Yes!  The
left: 1
property does exactly what I needed.  FYI to all:  you can't set this to 0.
Thanks Derek and Matt!


We'll get it fixed so you can set it to zero next update. I think setting it to "0" or 0.1 should work for now.
0 Kudos