All Projects → demtario → hes-gallery

demtario / hes-gallery

Licence: MIT license
Light, dependency free, responsive gallery script

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to hes-gallery

Nanogallery2
a modern photo / video gallery and lightbox [JS library]
Stars: ✭ 488 (+1707.41%)
Mutual labels:  photos, gallery, images, lightbox
React Grid Gallery
Justified image gallery component for React
Stars: ✭ 571 (+2014.81%)
Mutual labels:  photos, gallery, images, lightbox
Simple React Lightbox
A simple but functional light-box for React.
Stars: ✭ 265 (+881.48%)
Mutual labels:  gallery, images, lightbox
Lightgallery.js
Full featured JavaScript image & video gallery. No dependencies
Stars: ✭ 5,168 (+19040.74%)
Mutual labels:  gallery, lightbox, lightbox-gallery-plugin
Natural Gallery Js
A lazy load, infinite scroll and natural layout list gallery
Stars: ✭ 93 (+244.44%)
Mutual labels:  gallery, responsive, lightbox
react-gallery-carousel
Mobile-friendly gallery carousel 🎠 with server side rendering, lazy loading, fullscreen, thumbnails, touch, mouse emulation, RTL, keyboard navigation and customisations.
Stars: ✭ 178 (+559.26%)
Mutual labels:  gallery, responsive, lightbox
Glightbox
Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
Stars: ✭ 702 (+2500%)
Mutual labels:  gallery, responsive, lightbox
fancybox
jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable.
Stars: ✭ 7,261 (+26792.59%)
Mutual labels:  gallery, responsive, lightbox
Silentbox
A lightbox inspired Vue.js component.
Stars: ✭ 196 (+625.93%)
Mutual labels:  gallery, images, lightbox
Zoomwall.js
A content-focused photo gallery using a horizontal masonry layout that scales up in lightbox mode.
Stars: ✭ 254 (+840.74%)
Mutual labels:  photos, gallery, lightbox
react-simple-image-viewer
Simple image viewer component for React
Stars: ✭ 44 (+62.96%)
Mutual labels:  gallery, images, lightbox
Baguettebox.js
⚡ Simple and easy to use lightbox script written in pure JavaScript
Stars: ✭ 2,252 (+8240.74%)
Mutual labels:  gallery, responsive, lightbox
Photo view
📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.
Stars: ✭ 1,280 (+4640.74%)
Mutual labels:  photos, gallery, images
Floral
Minimal design gallery app for Android.
Stars: ✭ 23 (-14.81%)
Mutual labels:  gallery, images
Ownphotos Frontend
Stars: ✭ 171 (+533.33%)
Mutual labels:  photos, gallery
Gallery shell
📷 Bash Script to generate static responsive image web galleries.
Stars: ✭ 198 (+633.33%)
Mutual labels:  photos, gallery
Unsplash rb
💎 Ruby wrapper for the Unsplash API.
Stars: ✭ 202 (+648.15%)
Mutual labels:  photos, images
Aphotomanager
Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
Stars: ✭ 164 (+507.41%)
Mutual labels:  photos, gallery
Exiftool Vendored.js
Fast, cross-platform Node.js access to ExifTool
Stars: ✭ 200 (+640.74%)
Mutual labels:  photos, images
Ownphotos
Self hosted alternative to Google Photos
Stars: ✭ 2,587 (+9481.48%)
Mutual labels:  photos, gallery

HesGallery

licence version downloads

Light, dependency free script creating a responsive gallery

Instalation

Attach scripts to page You can use a hosted version by hooking this script or import it locally by downloading a package of files, but remember to attach a CSS style sheet and disable the auto-hooking of styles in the options (more in Global options section).

<script src="https://unpkg.com/hes-gallery/dist/hes-gallery.min.js"></script>

When using CDN global object HesGallery will be registred

You can also install package by npm or yarn

$ npm i hes-gallery

$ yarn add hes-gallery

How to use?

For each container with photos that you want to use as a gallery, give the class: (Each container is a singe, independent gallery)

.hes-gallery

You can modify the options of the gallery using function described below

Sample gallery design

<div class="hes-gallery">
  <img src="image1.jpg" alt="image1" data-subtext="Subtext" />
  <img src="image2.jpg" alt="image2" data-subtext="Second subtext" />
  <img src="image3.jpg" alt="image3" data-subtext="Subtext" />
  <img src="image4.jpg" alt="image4" data-subtext="Subtext" />
</div>

Global options

If you want, you can modify the gallery options to make it work better to you by using function HesGallery.setOptions(), you can also change settings passing settings object to HesGallery.init() function. Sample:

HesGallery.setOptions({
  wrapAround: true,
  disableScrolling: true,
})

HesGallery.init({
  wrapAround: true,
  disableScrolling: true,
})

Important If you change the settings after initializing the script, not all options can be applied. To make sure that they will, use HesGallery.init(options) function.

Possible options:

Parameter Default Description
wrapAround false Create loop on gallery, you can go from last photo to first with one click
showImageCount true Show number of current photo (for example "1/5")
disableScrolling false Disable scrolling when gallery is on
hostedStyles true Automatically attaches a style sheet to the source on api.heseya.com (turn off if you want to put hes-gallery on your own server)
animations true Using animations in gallery
keyboardControl true Keyboard control in galleries
minResolution 0 The minimum screen width for which the gallery will work (in px)
autoInit true If true, automaticly run HesGallery.init() when DOM Content is loaded
linkNested false If true, you can use images nested in links

Options of single gallery

If you like, you can give one set of other options by adding attributes to the .hes-gallery class's container Attributes accept only true or false value, in any other case the gallery will adopt values set by HesGallery.setOptions () or default!

<div class="hes-gallery" data-wrap="true" data-img-count="false">
  <!-- Some <img> here -->
</div>

Available local options:

Parameter Global equivalent Description
data-wrap wrapAround Create loop on gallery, you can go from last photo to first with one click
data-img-count showImageCount Show number of current photo (for example "1/5")

Available functions

Some of functions which you can use to manage the gallery

Function Description
HesGallery.init() Reloads the gallery in case when for example content of gallery container has changed and we want to have actual images in gallery
HesGallery.show(m, n) Show n photo from m gallery
HesGallery.next() Show next photo
HesGallery.prev() Show previous photo
HesGallery.hide() Hide gallery
HesGallery.setOptions() Allows you to modify the gallery options (more above)

Img tag parameters

Parameter Description
data-subtext He creates a signature under the picture in the gallery
data-disabled If set will cause that the image will not be included in the gallery
data-fullsize If we want to use thumbnails, we give the thumbnail path to the src tag and a path to the full version of graphics to the data-fullsize tag
data-src Some plugins (PR #12) can use this attribute to get the path to the photo. If this param exists, the HesGallery will use it, insead of the src attribute

Images nested in Links

To support browsers without JavaScript, an option is to statically link the "large" images like so:

<div class="hes-gallery">
  <a href="image1-large.jpg" class="hg-image">
    <img src="image1-small.jpg" alt="image1" data-subtext="Subtext" />
  </a>
  ...
</div>

In that case, users can still open an expanded view but if JS is enabled, they get the HesGallery. To enable this feature, set linkNested to true in the options during initialisation.

Contribution

Feel free to contribute any changes/features for future versions of HesGallery. Please work, and create Pull Pequests on develop branch.

To run build scripts you probably need node in version 11.

How to run?

  1. Install dependecies with npm i command
  2. By npm run dev you can run development server with gulp & browsersync to faster the development of your feature
  3. You can also use a npm run build to only build a script by babel and minimalize code
  4. It would be also greate if you can provide a examples of your feature in readme and in /demo folder
  5. When you finish, push your changes and create a Pull Request

Thanks for your help!

Licence: MIT Copyright 2019 Artur Mędrygał

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].