Giter Site home page Giter Site logo

jonnitto.photoswipe's Introduction

Latest stable version Total downloads License GitHub forks GitHub stars GitHub watchers GitHub followers Follow Jon on Twitter

Jonnitto.PhotoSwipe

This package includes PhotoSwipe into Neos CMS

Version Neos Maintained
0.* 2.*
> 1.4 3.* + 4.*
2.* 3.3 + 4.*
> 3.* 3.3 + 4.*
>= 3.1.2 3.3 - 8.*
4.* 7.3 - 8.*

Required HTML markup

Each element that matches the selector a.lightbox must have such attributes:

  • Image URL in href or data-pswp-src attribute (latter has higher priority).
  • Image width in data-pswp-width.
  • Image height in data-pswp-height.

And optionally:

  • <img> thumbnail within the link element that will be displayed before the large image is loaded
  • Optional data-cropped="true" attribute if thumbnail is cropped. See also Animating from Cropped Thumbnail. PhotoSwipe API supports almost any markup and any data source, read more about it here.

Example:

<a
  class="lightbox"
  data-pswp-width="2560"
  data-pswp-height="1200"
  href="path/to/image.jpg"
  >...</a
>

Javascript variables

There is one global variable who get set during the intialisation:

neosPhotoSwipe This object stores the lightbox variables from PhotoSwiper. (The variable who get used to call lightbox.init()). With this, you can add you own event listener or trigger methods.

Javascript event listener

If you dispatch the event neos-photoswipe:init all type of lightboxes get initialized. Great if you work in AJAX enviroments. You can also activate a specific type of lightbox: neos-photoswipe.images:init, neos-photoswipe.fetch:init or neos-photoswipe.template:init.

Example:

window.dispatchEvent(new Event("neos-photoswipe:init"));

Alter generated markup

Adding custom attributes to the PhotoSwipe container

You can add custom attributes to the PhotoSwipe container like this:

Jonnitto:
  PhotoSwipe:
    additonalPswpContainerAttributes:
      data-turbo-temporary: true
      class: 'my-custom-class'

Adding custom attributes to the link in the error fetch message

Jonnitto:
  PhotoSwipe:
    fetchAttributeErrorMessages: 'data-pswp-type="fetch" data-turbo="false"'

Installation

Most of the time you have to make small adjustments to a package (e.g. configuration in Settings.yaml). Because of that, it is important to add the corresponding package to the composer from your theme package. Mostly this is the site packages located under Packages/Sites/. To install it correctly go to your theme package (e.g.Packages/Sites/Foo.Bar) and run following command:

composer require jonnitto/photoswipe --no-update

The --no-update command prevent the automatic update of the dependencies. After the package was added to your theme composer.json, go back to the root of the Neos installation and run composer update. Et voilà! Your desired package is now installed correctly.

jonnitto.photoswipe's People

Contributors

dependabot[bot] avatar jonnitto avatar sebobo avatar tbrodard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jonnitto.photoswipe's Issues

Italian translation

Can someone write the translation in Italian in this issue?

<trans-unit id="share.facebook" xml:space="preserve">
    <source>Share on Facebook</source>
</trans-unit>
<trans-unit id="share.twitter" xml:space="preserve">
    <source>Tweet</source>
</trans-unit>
<trans-unit id="share.pinterest" xml:space="preserve">
    <source>Pin it</source>
</trans-unit>
<trans-unit id="share.download" xml:space="preserve">
    <source>Download image</source>
</trans-unit>

Javascript text translation

Hello,
What do you suggest to translate text in javascript like "Share", "Download image" without change the javascript file ?
Great package btw :)

French translation

Can someone write the translation in French in this issue?

<trans-unit id="share.facebook" xml:space="preserve">
    <source>Share on Facebook</source>
</trans-unit>
<trans-unit id="share.twitter" xml:space="preserve">
    <source>Tweet</source>
</trans-unit>
<trans-unit id="share.pinterest" xml:space="preserve">
    <source>Pin it</source>
</trans-unit>
<trans-unit id="share.download" xml:space="preserve">
    <source>Download image</source>
</trans-unit>

run => install

Hi, some one can tell me how run or install it in Neos?
I use docker...

thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.