Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <script>
  2. $("#content img").hover(function() {
  3. var imageCaption = $(this).attr("alt");
  4. if (imageCaption != '') {
  5. var imgWidth = $(this).width();
  6. var imgHeight = $(this).height();
  7. var position = $(this).position();
  8. var positionTop = (position.top + imgHeight - 26)
  9. $("<span class='img-caption'><em>" + imageCaption +
  10. "</em></span>").css({
  11. "font-style": "normal !important",
  12. "color": "#fff",
  13. "position": "absolute",
  14. "top": "200px",
  15. "left": "5px",
  16. "width": "80%"
  17. }).insertAfter(this);
  18. }},function(){$(this).siblings('.img-caption').remove();}
  19. );
  20. </script>
  21.  
  22. .img-caption {
  23. font-style: normal !important;
  24. color: #fff;
  25. position: absolute;
  26. top: 200px;
  27. left: 5px;
  28. width: 80%;
  29. pointer-events: none;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement