- Overview
- Documents
Magneticmediajs is a JavaScript jQuery based library that will allow your media content (images, videos, maps, HTML & more) to be displayed in a memorable way to your audience. Don't just let your videos or photos on the side of your site or application: we built Magneticmediajs to make your media content easly and rapidlt accesible to your users.
Magneticmediajs is mobile first project. It was built to run on most modern internet connected devices (iOS, Android, Desktop and other devices) through the use of the latest responsive, JavaScript & CSS3 techniques with fallbacks for older devices where possible.
It will take input from popular platforms like Youtube, Vimeo, Instagram, Flickr, Dailymotion
Supported devices and browsers
We have taken time to test Magneticmediajs so that your audience can get a top-notch experience on as much devices and browsers as possible. Below is a list of browsers and systems where we know Magneticmediajs will work at its best. We welcome feedback so use our contact form to get in touch or provide bug reports.
Tested browsers |
Firefox 4+ |
Chrome 12+ |
Internet Explorer 9+ |
Safari 4+ |
Opera 12+ |
Tested operating systems |
iOS 6+ |
Android 4+ |
Windows 7, 8+ |
Mac OS X 10.7+ |
Linux Ubuntu 12+ |
-
sex shop
sex shop
sex shop
sex shop
sex shop
seks shop
spanish fly
psikolog
sohbet numara
sohbet hatti
Source: magneticmediajs.com
1. INCLUDE CSS AND JS FILES
<link rel="stylesheet" type="text/css" href="css/mmjs-1.1.0.css" /> <script src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> <script src="js/mmjs-1.1.0.min.js"></script>
2. HTML
Add HTML element with id to DOM
The id will reference on which element to fire Magneticmediajs. Magneticmediajs supports multiple instances so you can have multiple items on the same page with different options.
<div id="itemToDisplay">Check This View</div>
3. JAVASCRIPT
$(document).ready(function() { $('#imageToDisplay').magneticmediajs({ color1:'000000', color2:'EEEEEE', borderWidth:8, borderRadius:8, background:'000000', backgroundOpacity:0.8, displayTitle:true, data:[ ['image','images/london1.jpg','Big Ben - London - United Kingdom'], ] }); });
4. OPTIONS
Option | Example | Definition | Type | Format | Default |
---|---|---|---|---|---|
color1 |
color1:'080808' |
color of the border when an item is shown | String | in HEX format with no # | '080808' |
color2 |
color2:'fdfdfd' |
color of the font and icons when an item is shown | String | in HEX format with no # | 'fdfdfd' |
borderWidth |
borderWidth:8 |
width of the border when an item is shown - Acceptable values range from 0 (no border) to 20 (thick border) | Number | in pixels | 8 |
borderRadius |
borderRadius:8 |
border radius of the border when an item is shown - Acceptable values range from 0 (square border) to 20 (round border) | Number | in pixels | 8 |
background |
background:'000000' |
background color for the surronding when an item is shown | String | in HEX format with no # | '000000' |
backgroundOpacity |
backgroundOpacity:0.7 |
background opacity for the surronding when an item is shown | Number | in pixels | 0.7 |
displayTitle |
displayTitle:true |
display a title for the item shown at the bottom of the screen - not available if data is of html type | Boolean | false | |
displayTitle - title text |
data:[ ['image','image.jpg','title'] ] |
when displayTitle is set to true the text information for the title needs to go in the data array as shown on the left (it must always be in last position for each item with a title) | String | ||
data |
data:[ ['image','image.jpg'] ] |
an array to describe media content to be displayed. For multiple items it consists of an array of array | Array | [] |
Advanced options - Pro edition and above
Option | Example | Definition | Type | Format | Default |
---|---|---|---|---|---|
videoWidth |
videoWidth:960 |
maximum width of the video player. The video player will scale based on available viewport up to this value | Number | in pixels | 640 |
videoHeight |
videoHeight:360 |
maximum height of the video player. The video player will scale based on available viewport up to this value | Number | in pixels | 360 |
autoPlayVideo |
autoPlayVideo:true |
autoplay video when an item is shown. Will not work on mobile due to Android and iOS restrictions on the matter | Boolean | false | |
sharing |
sharing:true |
display sharing icons for Twitter and Facebook for the item shown | Boolean | false | |
facebookID |
facebookID:XXXXXXXXXX |
required facebook App ID for sharing. Facebook now requires this App ID for each sharing button | Number | ||
showIcons |
showIcons:true |
show icons corresponding to the available media content on each Media gallery and Media wall item | Boolean | true | |
gallery |
gallery:true |
display a mobile first media gallery | Boolean | false | |
galleryMaxThumbnailHeight |
galleryMaxThumbnailHeight:150 |
the maximum height of thumbnail images within the gallery | Number | in pixels | 150 |
mediaWall |
mediaWall:true |
display a responsive media wall with multiple items support | Boolean | false | |
mediaWallBorder |
mediaWallBorder:2 |
border width between items in the media wall | Number | in pixels | 2 |
mediaWallColumns |
mediaWallColumns:4 |
maximum number of columns for the media wall. The number of columns will change based on the available viewport up to this value | Number | 4 | |
zoomOn |
zoomOn:true |
activate zoom feature (magnifying glass) - only works for image content (including content from Instagram and Flickr) | Boolean | false | |
zoomLevel |
zoomLevel:2 |
the magnifying level - acceptable range from 1 (x1 magnifying) to 4 (x4 magnifying) | Number | 2 | |
zoomType |
zoomType:'lens' |
the zoom effect - 'default' (cube) or 'lens' (round) | String | 'default' | |
zoomSize |
zoomSize:200 |
the zoom display area - acceptable range from 100 to 300 pixels | Number | in pixels | 200 |
Responsive design note: the media gallery and the media wall parent element must be responsive for them to be responsive. For example you can set the width or the parent element in %
Media content as an input - the data array
Data array supported type & structure
Data type | Example | Definition |
---|---|---|
Image |
data:[ ['image','image.jpg'] ] |
image - URL or path to main image |
Flickr |
data:[ ['flickr','124135045@N03','london1'] ] |
flickr - Flickr user_id - Flickr photo title |
data:[ ['instagram','http://instagram.com/p/q1vsU0OmxC/'] ] |
instagram - Instagram URL for image | |
Video (HTML5/Flash) |
data:[ ['video','movie.mp4'] ] |
video - URL or path to mp4 |
Youtube |
data:[ ['youtube','OG-pyPSzIO0'] ] |
youtube - video id from Youtube |
Vimeo |
data:[ ['vimeo','44964114'] ] |
vimeo - video id from Vimeo |
Dailymotion |
data:[ ['dailymotion','x1yj6t9'] ] |
dailymotion - video id from Dailymotion |
HTML |
data:[ ['html','<iframe src="http://"></iframe>'] ] |
html - HTML content (iframe, object, form ...) |
HTML with JavaScript |
data:[ ['html-js','<div style="">Hello World!</div>', 'alert("Some JavaScript code was executed");'] ] |
html-js - HTML content (iframe, object, form ...) - JavaScript code to run when item is shown (code is executed just after the HTML content is appended to the DOM) |
Google Maps |
data:[ ['maps','AIzaSyBUoQMtQL-nT1t2DyY-vLWf4j3oIh850Zw', 43.526112, 5.440660, 7, 'This is a great place', '<div> Meet us there!</div>'] ] |
maps - Google API key - Latitude - Longitude - Zoom level - Title of location - Description of location |
Note: an example of implementation for single items is available in demo-single-item.html which is included with each purchase (in your downloaded package)
Data array structure for Media gallery & Media wall
You need to specify information for the thumbnails as follows:
Data type | Example | Definition |
---|---|---|
Image |
data:[ ['image','thumbnail.jpg','image.jpg'] ] |
image - URL or path to thumbnail - URL or path to image |
Flickr |
data:[ ['flickr','124135045@N03','london1'] ] |
flickr - Flickr user_id - Flickr photo title (thumbnail is taken from Flickr API) |
data:[ ['instagram','http://instagram.com/p/q1vsU0OmxC/', 'http://instagram.com/p/q1vsU0OmxC/'] ] |
instagram - Instagram URL for thumbnail - Instagram URL for image | |
Video (HTML5/Flash) |
data:[ ['video',thumbnail.jpg','movie.mp4'] ] |
video - URL or path to thumbnail - URL or path to mp4 |
Youtube |
data:[ ['youtube','medium','OG-pyPSzIO0'] ] |
youtube - small, medium or large thumbnail from Youtube API - video id from Youtube |
Vimeo |
data:[ ['vimeo','medium','44964114'] ] |
vimeo - small, medium or large thumbnail from Vimeo API - video id from Vimeo |
Dailymotion |
data:[ ['dailymotion','medium','x1yj6t9'] ] |
dailymotion - small, medium or large thumbnail from Dailymotion API - video id from Dailymotion |
HTML |
data:[ ['html',thumbnail.jpg', '<iframe src="http://www.html5rocks.com/en/"></iframe>'] ] |
html - URL or path to thumbnail - HTML content (iframe, object, form ...) |
HTML with JavaScript |
data:[ ['html-js','thumbnail.jpg', '<div style="">Hello World!</div>', 'alert("Some JavaScript code was executed");'] ] |
html-js - URL or path to thumbnail - HTML content (iframe, object, form ...) - JavaScript code to run when item is shown (code is executed just after the HTML content is appended to the DOM) |
Google Maps |
data:[ ['maps',thumbnail.jpg', 'AIzaSyBUoQMtQL-nT1t2DyY-vLWf4j3oIh850Zw', 43.526112, 5.440660, 7, 'This is a great place', '<div> Meet us there!</div>'] ] |
maps - Google API key - Latitude - Longitude - Zoom level - Title of location - Description of location |
Note: examples of implementation for Media gallery and Media wall are available in demo-gallery.html and demo-mediawall.html which are included with each purchase (in your downloaded package)
5. API
Variables
You check if an item is on stage (an item has been interacted with by a user and is currently displayed) at any moment with the variable mmItemOnStage. mmItemOnStage is of type Boolean
if(mmItemOnStage){ //an item is displayed on stage }
To check what is the id of the item on stage you can use
$('.mmFullScreen').children().first().attr('id')
Methods
Open an item: mmjsOpen
For a single item. Example: open item with id singleItem
$('#singleItem').magneticmediajs('mmjsOpen','singleItem');
For an item within media gallery or media wall. Example: open item 4 (first item has id mm0)
$('#gallery').magneticmediajs('mmjsOpen','mm3');
The first paramater is the name of the invoked method - in this case mmjsOpen - the second parameter is the id of the item to open.
Close an item: mmjsClose
$('#gallery').magneticmediajs('mmjsClose');
The first paramater is the name of the invoked method - in this case mmjsClose
Display previous item: mmjsPrevious
$('#gallery').magneticmediajs('mmjsPrevious');
The first paramater is the name of the invoked method - in this case mmjsPrevious
Display next item: mmjsNext
$('#gallery').magneticmediajs('mmjsNext');
The first paramater is the name of the invoked method - in this case mmjsNext
Deeplinking
If you use the media gallery or the media wall each item can be accessed with a single URL. Just add the magnetid query string as follows:
http://<yoururl>/index.html?magnetid=mm0
This will display your first item in your data array (index starts at 0).
Each item in the media gallery or media wall can be accessed with magnetid query string equal to mmi where i corresponds to the index of the item in the data array.
If you use a single item you can access this item through a single URL as follows:
http://<yoururl>/index.html?magnetid=mmelementid
Where elementid is the id of your html element on which magneticmediajs is fired.
7. KEYBOARD CONTROL
Open a media item: Spacebar (Key code 32)
Close a media item: Esc (Key code 27)
Display previous media item: Left Arrow (Key code 37)
Display next media item: Right Arrow (Key code 39)