Here's another option, you can change whether the layer title is displayed or not based on the position of the swipe widget. In this sample, I only show layer2 (left side) label when the swipe widget is less than position 25, I only show layer1 (right side) label when position is greater than 75, and I show both labels otherwise.
https://codepen.io/annefitz/pen/zYBgROw
This is one option for displaying the layer titles when swiping: you can update the opacity of the layer title based on the position of the Swipe widget. Here's an example: https://codepen.io/annefitz/pen/ZEOZyOz
Here's another option, you can change whether the layer title is displayed or not based on the position of the swipe widget. In this sample, I only show layer2 (left side) label when the swipe widget is less than position 25, I only show layer1 (right side) label when position is greater than 75, and I show both labels otherwise.
https://codepen.io/annefitz/pen/zYBgROw