Categories: CSSScriptWeb Design

Minimal Image Panning Library – LC-Mouse-Drag

A tiny image panning JavaScript library that provides a smooth drag-to-pan functionality on images.

Supports both mouse drag and touch swipe events.

Table of Contents

Toggle

How to use it:

1. Import the lc-mouse-drag.js JavaScript library into the document.

<script src="lc-mouse-drag.js"></script>

2. Initialize the library on the image container as follows:

<div id="inner">
  <img src="demo.webp" />
</div>
lc_mouseDrag('#inner');

3. Determine the animation delta when ending dragging. Default: 0.3.

lc_mouseDrag('#inner', 0);

4. Disable X-axis and/or Y-axis dragging. Default: false.

Sponsored
lc_mouseDrag('#inner',

Sponsored
0, true, false);

5. Important CSS rules for desktop.

body:not(.lc_mousedrag_is_mobile) #inner {
  overflow: hidden;
  cursor: grab;
}

Changelog:

v1.0.2 (10/31/2025)

  • new: now truly detects deviceses with a cursor to operate

The post Minimal Image Panning Library – LC-Mouse-Drag appeared first on CSS Script.

rssfeeds-admin

Share
Published by
rssfeeds-admin

Recent Posts

News alert: Qevlar AI raises $30M to turn security alerts into actionable defense insights across SOCs

PARIS, March 10, 2026 — Qevlar AI, a leader in AI for transforming security operations…

3 minutes ago

Millenarian Fantasies

In Beirut, we start our days with the latest litany of places and people hit…

3 minutes ago

Independent product designer Allan Buntoengsuk uses GreatPen.xyz to share product, UX, and software design work

GreatPen.xyz – Squarespace customer – (United States) The .xyz community includes independent designers and creatives…

3 minutes ago

Australia’s National Film and Sound Archive Acquires World’s First Licensed Star Wars Pinball Machine

The National Film and Sound Archive (NFSA) of Australia has today announced it has acquired…

23 minutes ago

Pluralistic: AI “journalists” prove that media bosses don’t give a shit (11 Mar 2026)

Today's links AI "journalists" prove that media bosses don't give a shit: In case there…

38 minutes ago

What these new leadership appointments tell us about the future of the AI industry

AI can draft emails, analyze data and complete tasks at an incredible speed, but the…

43 minutes ago

This website uses cookies.