-
Notifications
You must be signed in to change notification settings - Fork 3
Media Functions
Benedikt Schulze Baek edited this page Mar 23, 2017
·
11 revisions
This is a collection of media features. I.e. you can show image galleries with a lightbox function or you can make use of an image upload function.
Creates and manages a gallery from image urls.
Supported Platforms
- Android
- iOS
- ChaynsWeb
Table of Contents
Creates a gallery with the provided urls.
Parameter
- id : string - The unique id of the gallery.
- urls : string[] - The image urls.
document.getElementById('#identifier').appendChild(
chayns.ui.gallery.create('MyGallery', ['myImage.jpg'])
);
This method replaces the gallerys urls by the urls in this array and returns true on success.
Parameter
- identifier : string - The id of the gallery.
- urls : string[] - The image urls that will be set for the gallery.
chayns.ui.gallery.setUrls('MyGallery', ['myImage.jpg']);
This method returns an array containing all urls of the gallery (only works if the gallery was created using JavaScript).
Parameter
- id : string - Id of the specific galelry.
Result
- urls : string[] - An array containg all image urls set for the gallery.
chayns.dialog.alert('',
JSON.stringify(chayns.ui.gallery.getUrls('MyGallery'))
);
chayns.ui.gallery.addurl(id, url) This method adds an image url to the gallery and returns true on success.
Parameter
- id : string - Id of the gallery.
- url : string - The image url.
chayns.ui.gallery.addUrl('MyGallery', 'myImage.jpg');
<!-- To get started.. -->
<!-- Load the chayns API styles and JavaScript from our server -->
<!-- css styles -->
<script src="https://api.chayns-static.space/css/v4/compatibility/compatibility.min.js" version="4.2"></script>
<!-- js api -->
<script src="https://api.chayns-static.space/js/v4.0/chayns.min.js"></script>