custom.js 554 B

1234567891011121314151617181920212223242526
  1. function onReady() {
  2. $(`p>img`)
  3. .after(appendExpandButton)
  4. .next()
  5. .on('click', onExpandButton);
  6. $(`#expand-img button`).on(`click`, onHideImgExpand);
  7. }
  8. function appendExpandButton(img) {
  9. return `<btn class='btn btn-primary' data-img="${this.src}">+<btn>`
  10. }
  11. function onExpandButton(e) {
  12. var imgSrc = this.getAttribute(`data-img`);
  13. $(`#expand-img img`).attr(`src`, imgSrc);
  14. $(`#expand-img`).show(0);
  15. }
  16. function onHideImgExpand() {
  17. $(`#expand-img`).hide(500);
  18. }
  19. (function() {
  20. $(document).ready(onReady)
  21. })()