Slide To Shutdown Windows 11 Page
// calculate max offset based on current track width and thumb width function recalcMaxOffset() !thumb) return; const trackWidth = trackContainer.clientWidth; const thumbWidth = thumb.offsetWidth; // max offset = track width - thumb width (with some margin) let newMax = Math.max(0, trackWidth - thumbWidth); // also consider any padding? container padding is 0, track has no horizontal padding, but dragZone is full width. // ensure pixel perfect maxOffset = newMax; // if shutdown already triggered, keep thumb at end; else if we need to realign if(!shutdownTriggered) // keep current position within new limits if(currentTranslateX > maxOffset) currentTranslateX = maxOffset; if(thumb) thumb.style.transform = `translateX($currentTranslateXpx)`; updateFillAndLabel(currentTranslateX); else // just refresh fill style updateFillAndLabel(currentTranslateX);
isDragging = true; // store start thumb offset and start pointer X const thumbRect = thumb.getBoundingClientRect(); const currentThumbLeft = thumbRect.left; startX = clientX - currentThumbLeft; // set capturing for smooth move thumb.setPointerCapture(e.pointerId); document.body.style.cursor = 'grabbing'; slide to shutdown windows 11
.slider-track background: rgba(255, 255, 255, 0.05); border-radius: 100px; position: relative; cursor: grab; transition: background 0.1s; // calculate max offset based on current track
.power-icon svg width: 64px; height: 64px; stroke: #f0f3fc; stroke-width: 1.3; fill: none; While it was originally designed for tablets and
.thumb-icon font-size: 1.7rem;
The feature in Windows 11 is a sleek, hidden interface that allows you to power off your device with a simple downward swipe or mouse drag. While it was originally designed for tablets and touch-enabled laptops like the Surface, it is accessible on any PC, offering a modern alternative to the traditional multi-click Start menu path. What is Slide to Shut Down?
