响应式全屏图片库 jQuery故事展示库

  • 源码大小:523.98KB
  • 所需积分:1积分
  • 源码编号:19JP-3061
  • 浏览次数:1335次
  • 最后更新:2023年05月01日
  • 所属栏目:图库
我要下载
加入收藏
本站默认解压密码:19jp.com 或 19jp_com

简介

Story Show Gallery是一个轻量级、灵活、响应迅速、交互式的jQuery照片库插件,专为台式机、平板电脑和移动设备创建。

单击缩略图和链接将在全屏垂直滑块中显示所有图像,用户可以通过鼠标滚轮、箭头键和触摸滑动事件在图像中导航。

根据GNU通用公共许可证v3.0许可。

如何使用它:

1.在文档中插入最新版本的jQuery库和Simple Scroll Gallery插件的文件。

  1. <script src="/path/to/cdn/jquery.min.js"></script>
  2. <link rel="stylesheet" href="ssg.css" />
  3. <script src="ssg.js"></script>

2.将图片和链接包装到图库容器中。

  1. <section class="gallery">
  2.  
  3. <a href='large.jpg'>
  4. <img src="thumb.jpg" alt="Image 1">
  5. </a>
  6.  
  7. <a href='large.jpg' data-author='photo by…'>
  8. <img src="thumb.jpg" alt="Image 1">
  9. </a>
  10.  
  11. <a href='large.jpg'>
  12. <img src="thumb.jpg" alt="Image 1">
  13. </a>
  14.  
  15. <a href='large.jpg'>Link is supported as well</a>
  16.  
  17. ...
  18. </section>

3.就是这样。要使库全屏显示,只需将CSS类“fs”添加到容器元素中:

  1. <section class="fs gallery">
  2.  
  3. <a href='large.jpg'>
  4. <img src="thumb.jpg" alt="Image 1">
  5. </a>
  6.  
  7. <a href='large.jpg' data-author="Custom Author" data-caption="Custom Caption">
  8. <img src="thumb.jpg" alt="Image 1">
  9. </a>
  10.  
  11. <a href='large.jpg'>
  12. <img src="thumb.jpg" alt="Image 1">
  13. </a>
  14.  
  15. <a class="fs" href='large.jpg'>Link is supported as well</a>
  16.  
  17. ...
  18.  
  19. </section>

4.更多的CSS类来控制库。

  • ssg公司:若要创建单独的库,请将此CSS类添加到父容器中。
  • 编号:忽略使用此CSS类的图像。
  • 高斯:使用这个CSS类设置初始图像。
  • vipssg公司:设置VIP图像。
  • 密码:灯光主题。
  • ssgdim公司:黑暗主题。
  • ssg缺失:黑色主题。
  1. <section class="ssg fs vipssg ssgblack">
  2.  
  3. <a href='large.jpg'>
  4. <img src="thumb.jpg" alt="Image 1">
  5. </a>
  6.  
  7. <a href='large.jpg'>
  8. <img src="thumb.jpg" alt="Image 1">
  9. </a>
  10.  
  11. <a href='large.jpg'>
  12. <img src="thumb.jpg" alt="Image 1">
  13. </a>
  14.  
  15. <a class="fs" href='large.jpg'>Link is supported as well</a>
  16.  
  17. ...
  18.  
  19. </section>

5.您也可以通过调用以下函数手动启动库:

  1. SSG.run();

6.然后通过如下所示的可选设置:

  1. SSG.run({
  2.  
  3. // init image ID
  4. initImgID: 3
  5.  
  6. // no close icon, no ESC key
  7. noExit: true,
  8.  
  9. // fullscreen mode
  10. fs: true,
  11.  
  12. // ask if a user wants to switch into fullscreen mode
  13. fsa: false,
  14.  
  15. // pass options here
  16. cfg: {}
  17. });

7.该插件还允许您通过JavaScript定义画廊中显示的图像:

  1. SSG.run({
  2. imgs: [
  3. {
  4. href: '1.jpg',
  5. alt: 'Img caption 1'
  6. },
  7. {
  8. href: '2.jpg',
  9. alt: 'Img caption 2'
  10. },{
  11. href: '3.jpg',
  12. alt: 'Img caption 3'
  13. }
  14. ],
  15. imgsPos:'start',
  16. initImgID: 12
  17. });

8.在开始时覆盖默认配置ssg.js公司.

  1. // duration of scroll animation in miliseconds. Set to 0 for no scroll animation.
  2. SSG.cfg.scrollDuration = 500;
  3.  
  4. // Force SSG to always display in fullscreen - true/false
  5. SSG.cfg.alwaysFullscreen = false;
  6.  
  7. // Force SSG to never display in fullscreen - true/false. There is an exception for smartphones and tablets
  8. SSG.cfg.neverFullscreen = false;
  9.  
  10. // When a mobile phone is in portrait mode, start SSG in fullscreen mode. But only if FS is demanded - fs class or fs:true.
  11. SSG.cfg.mobilePortraitFS = false;
  12.  
  13. // Visual theme of the gallery - four possible values: dim, light, black, dark (default)
  14. SSG.cfg.theme = 'dark'
  15.  
  16. // unobtrusive cross cursor
  17. SSG.cfg.crossCursor = false;
  18.  
  19. // URL of the HTML file to load behind the gallery (usually a signpost to other galleries).
  20. // HTML file has to be loaded over http(s) due to a browser's CORS policy. Set to null if you don't want it.
  21. SSG.cfg.fileToLoad = null;
  22.  
  23. // display social share icon and menu
  24. SSG.cfg.socialShare = true;
  25.  
  26. // hide image captions, it doesn't impact global caption or exif
  27. SSG.cfg.hideImgCaptions = false;
  28.  
  29. // Enlarge image above its original resolution. But only if the image is smaller than two third of screen. It doesn't work on mobiles and tablets.
  30. SSG.cfg.enlargeImg = false;
  31.  
  32. // EXIF info (or just the EXIF icon) appears as a part of the caption with link to full EXIF listing
  33. // 4 possible values: 'none' (no exif, default), 'standard', 'trim' (reduced lens info to save space), 'icon'
  34. SSG.cfg.captionExif = 'none';
  35.  
  36. // log image views into Google Analytics - true/false. SSG supports only ga.js tracking code.
  37. SSG.cfg.logIntoGA = true;
  38.  
  39. // Protect photos from being copied via right click menu - true/false
  40. SSG.cfg.rightClickProtection = true;
  41.  
  42. // Caption location depends on a photo size vs. screen size and SSG.cfg.preferedCaptionLocation.
  43. // Negative number => more likely side caption. Positive number => more likely caption below the photo.
  44. // If the number will be too large (eg: 300 or -300 ) a caption will be only in one location.
  45. SSG.cfg.preferedCaptionLocation = 3;
  46.  
  47. // Side caption for smaller, landscape oriented photos, where is enough space below them as well as on their side.
  48. SSG.cfg.sideCaptionforSmallerLandscapeImg = false; // false means caption below, true side caption
  49.  
  50. // an author signature (or some text), which will appear in every caption. The data-author attribute overrides it.
  51. SSG.cfg.globalAuthorCaption = "";
  52.  
  53. // Show first 3 images of a separate gallery together - e.g. third image clicked - image order will be 3,1,2,4,5,6...
  54. SSG.cfg.showFirst3ImgsTogether = true;
  55.  
  56. // Locking the scale of mobile viewport at 1. Set it to true if the gallery has scaling problem on your website.
  57. SSG.cfg.scaleLock1 = false;
  58.  
  59. // observe DOM for changes, so SSG will know about image hyperlinks that are added into page after page render
  60. SSG.cfg.observeDOM = false;
  61.  
  62. // image border width in pixels
  63. SSG.cfg.imgBorderWidthX = 1;
  64. SSG.cfg.imgBorderWidthY = 1;
  65. // image border color in CSS format (eg: #366988 or black)
  66. SSG.cfg.imgBorderColor = "";
  67. // image outline color in CSS format - imgBorderWidthX and imgBorderWidthY should be the same, otherwise outline won't fit
  68. SSG.cfg.imgOutlineColor = "";
  69. // Light effect on image border - it looks good mainly on thicker borders
  70. SSG.cfg.imgBorderLightFx = false;
  71. // radius is in vh unit, but above 33 is in percent of image size, so it is possible to achieve circle/ellipse (50)
  72. SSG.cfg.imgBorderRadius = 0;
  73. // display shadow around the image (border) as it is defined in the theme
  74. SSG.cfg.imgBorderShadow = true;
  75.  
  76. // Watermark - logo configuration. Enter watermark text or image URL to display it
  77. SSG.cfg.watermarkWidth = 147; // image watermark width in pixels, it is downsized on smaller screens.
  78. SSG.cfg.watermarkImage = ''; // watermark image URL e.g. 'https://www.flor.cz/img/florcz.png'
  79. SSG.cfg.watermarkText = ''; // watermark text, use <br> tag for word wrap
  80. SSG.cfg.watermarkFontColor = ""; // custom font color, it will deactivate dark text-shadow from theme
  81. SSG.cfg.watermarkFontSize = 20; // font size in pixels, it is downsized on smaller screens.
  82. SSG.cfg.watermarkOffsetX = 1.8; // watermark horizontal offset from left border in percents of photo, for align to right use value near 100
  83. SSG.cfg.watermarkOffsetY = 0.6; // vertical offset from bottom border in percents of photo, for align to top use value near 100
  84. // Watermark can be also positioned inside image border, use negative values to do so. Negative values are in pixels - as border width
  85. SSG.cfg.watermarkOpacity = 0.42; // opacity
  86.  
  87. // Here you can translate SSG into other language. Leave tags <> and "" as they are.
  88. SSG.cfg.hint1 = "Browse through Story Show Gallery by:";
  89. SSG.cfg.hint2 = "a mouse wheel <strong>⊚</strong> or arrow keys <strong>↓→↑←</strong>";
  90. SSG.cfg.hint3 = "or <strong>TAP</strong> on the bottom (top) of the screen";
  91. SSG.cfg.hintTouch = "<strong>TAP</strong> on the bottom (top) of the screen<br> or <strong>swipe</strong> to left (right) <br> to browse through Story Show Gallery.";
  92. SSG.cfg.hintFS = 'For a better experience <br><a><abbr>⎚</abbr> go full screen</a>';
  93. SSG.cfg.toTheTop = "Scroll to top";
  94. SSG.cfg.exitLink = "Exit the Gallery";
  95.  
  96. // share link dialog
  97. SSG.cfg.imageLink = "The link to selected image:";
  98. SSG.cfg.copyButton = "⎘ Copy the link to clipboard";
  99. SSG.cfg.linkPaste = "…and you can paste it anywhere via ctrl+v";
  100.  
  101. // in the portrait mode the gallery suggest to turn phone into landscape mode
  102. SSG.cfg.showLandscapeHint = true;
  103. SSG.cfg.landscapeHint = 'photos look better in landscape mode <span>

更新日志:

版本3.3.0(2023-04-24)

  • 缩略图的CSS布局

版本3.2.10(2023-03-26)

  • 纵向模式下的滑动支持

第3.2.8版(2023-02-17)

  • 禁用库中的边缘视觉搜索

第3.2.8版(2023-02-16)

  • CSS调整

第3.2.6版(2023-02-06)

  • bg不透明度、fontSize、CSS调整

第3.2.5版(2023-01-15)

  • 固定时间

第3.2.3版(2023-01-10)

  • 强制景观优化,CSS更新

版本3.2.2(2022-12-30)

  • 强制横向模式选项
  • 错误修复

第3.1.9版(2022-07-30)

  • 观测器优化

预览截图