Coherent fiber bundles can be used to relay the image plane from the distal tip of an endomicroscope to an external confocal microscopy system. The frame rate is therefore determined by the speed of the microscope's laser scanning system which, at 10-20 Hz, may be undesirably low for in vivo clinical applications. Line-scanning allows an increase in the frame rate by an order of magnitude in exchange for some loss of optical sectioning, but the width of the detector slit cannot easily be adapted to suit different imaging conditions. The rolling shutter of a CMOS camera can be used as a virtual detector slit for a bench-top line-scanning confocal microscope, and here we extend this idea to endomicroscopy. By synchronizing the camera rolling shutter with a scanning laser line we achieve confocal imaging with an electronically variable detector slit. This architecture allows us to acquire every other frame with the detector slit offset by a known distance, and we show that subtracting this second image leads to improved optical sectioning.