# To AI Agent: Implement Mobile Horizontal Image Panning Component ## 1. Context & Objective We are developing a travel application. We need to implement a mobile-first image viewer component. **CRITICAL REQUIREMENT:** When a user swipes/drags horizontally on mobile, the UI must NOT switch to the next image. Instead, it must smoothly scroll/pan horizontally to reveal the hidden, unexposed parts of the *same* wide/panoramic image. --- ## 2. Technical Stack & Scope - **Target Platform:** Mobile Web / Responsive (Touch-friendly). - **Preferred Method:** CSS-First approach utilizing Viewport Overflow (for optimal GPU performance and native inertia scrolling). - **Avoid:** Do NOT use global slider libraries (like standard Swiper/Slick) if they force image switching behavior. --- ## 3. UI/UX Specifications ### A. DOM Structure - A wrapper/container acting as the "window view" (`.image-pan-container`). - The target wide/panoramic image (`.image-pan-element`). ### B. CSS Rules & Constraints 1. **Container (`.image-pan-container`):** - Must have a fixed width (e.g., `100vw` or `100%` of parent). - Must set `overflow-x: auto` and `overflow-y: hidden` to enable horizontal touch scrolling only. - Must enable smooth scrolling (`scroll-behavior: smooth`) and native touch momentum (`-webkit-overflow-scrolling: touch`). - **Crucial:** Hide the native scrollbar across all major browsers (Webkit, Firefox, IE/Edge) to make it look like a native mobile app feature. 2. **Image Element (`.image-pan-element`):** - Must fit the container's height perfectly (`height: 100%`). - Width must be calculated automatically based on aspect ratio (`width: auto`). - Must override any global framework styles: enforce `max-width: none !important`. - Do NOT use `object-fit: cover` as it will crop the scrolling data. --- ## 4. Reference Code Blueprint Use the following snippet as a baseline for your implementation: ```html