Guest User

Untitled

a guest
Jun 22nd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <div id="slider">
  2. <img src="images/slide1.jpg" alt="" />
  3. <a href="http://dev7studios.com"><img src="images/slide2.jpg" alt="" title="#htmlcaption" /></a>
  4. <img src="images/slide3.jpg" alt="" title="This is an example of a caption" />
  5. <img src="images/slide4.jpg" alt="" />
  6. </div>
  7.  
  8. $(function(){
  9. $.each(document.images, function(){
  10. var this_image = this;
  11. var src = $(this_image).attr('src') || '' ;
  12. if(!src.length > 0){
  13. //this_image.src = options.loading; // show loading
  14. var lsrc = $(this_image).attr('lsrc') || '' ;
  15. if(lsrc.length > 0){
  16. var img = new Image();
  17. img.src = lsrc;
  18. $(img).load(function() {
  19. this_image.src = this.src;
  20. });
  21. }
  22. }
  23. });
  24. });
  25.  
  26. <div id="slider">
  27. </div>
  28.  
  29. jQuery(function(){
  30. $("#slider").append('<img src="images/slide1.jpg" alt="" />');
  31. });
  32.  
  33. $(window).load(function () {
  34. // run code
  35. });
  36.  
  37. var image = new Image();
  38. image.src = "/path/to/huge/file.jpg";
  39.  
  40. image.onload = function() {
  41. ...
  42. }
  43.  
  44. <img class="b-lazy"
  45. src="placeholder-image.jpg"
  46. data-src="image.jpg"
  47. data-src-small="small-image.jpg"
  48. alt="Image description" />
  49.  
  50. var bLazy = new Blazy({
  51. breakpoints: [{
  52. width: 420 // Max-width
  53. , src: 'data-src-small'
  54. }]
  55. , success: function(element){
  56. setTimeout(function(){
  57. // We want to remove the loader gif now.
  58. // First we find the parent container
  59. // then we remove the "loading" class which holds the loader image
  60. var parent = element.parentNode;
  61. parent.className = parent.className.replace(/bloadingb/,'');
  62. }, 200);
  63. }
  64. });
  65.  
  66. <script type="text/javascript">
  67. jQuery(function(){
  68.  
  69. //your function implementation here...
  70.  
  71. });
  72. </script>
Add Comment
Please, Sign In to add comment