Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.solodev.com/blog/web-design/adding-magnific-popup-to-your-photo-gallery.stml
- <script type="text/javascript">
- function view_image(element){
- var src = $(element).find("img").attr('src');
- $('#view_image').attr('src', src);
- };
- $( document ).ready(function() {
- $(".gallery").removeAttr("style");
- });
- $(".gallery").magnificPopup({
- delegate: 'a', // the selector for gallery item
- type: 'image',
- gallery: {
- enabled:true
- },
- image: {
- tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
- titleSrc: function(item) {
- return item.el.attr('data-title') + '<small>by Solodev</small>';
- }
- }
- });
- //multiple Gallery class use
- $('.gallery').each(function() { // the containers for all your galleries
- $(this).magnificPopup({
- delegate: 'a', // the selector for gallery item
- type: 'image',
- gallery: {
- enabled:true
- },
- image: {
- tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
- titleSrc: function(item) {
- return item.el.attr('data-title') + '<small>by Solodev</small>';
- }
- }
- });
- });
- </script>
Add Comment
Please, Sign In to add comment