0

Website url: https://members.luscious.net/ What I am trying to achieve is to make a script which would automatically get a src attribute of an image that is currently showing on screen (from a plugin loader) so as the images apper on the screen, the href of the link would be changing to the source, i make a code so far work but only at scrolling to the bottom, i tride add buttom on top etc. but not working... (using greasemonkey pass trought)...

var $lc = jQuery.noConflict();

var tittle = $lc('#single_album_details li.album_cover h2').html();
    tittle = titulo.toLowerCase().replace(/\b[a-z]/g, function(letter) {
      return letter.toUpperCase();
    }); 
$lc(window).scroll(function() {
       if($lc(window).scrollTop() + $lc(window).height() ==   $lc(document).height()) {
          $lc('div[id^="picture_"] a img').each(function() {
            var Checker = $lc(this).attr('state');
            if(Checker !== 'undefined' && Checker !== 'ok'){
              var srcA= $lc(this).attr('src').replace(/\.(?=[^.]*$)/,'»');
              var srcB = srcA.replace(/\.(?=[^.]*$)/,'»');
              var srcC = srcB.replace(/\».+\»/,'.');
              $lc(this).parent().attr('href',srcC);
              $lc(this).attr('state','ok');
              $lc(this).attr('alt',tittle);
            }
          });
       }
    });
yaelmania
  • 25
  • 4
  • Like this? https://stackoverflow.com/questions/54040130/is-there-a-css-option-that-links-an-html-image-to-itself – Diodeus - James MacFarlane Jan 04 '19 at 20:09
  • the idea is after page load like 60 images and gallery have like 200 images stop loading after reach 60, and load more if you scroll to bottom me script get image source to full image, but when the galery is big like 500 or more image load faster the me code so the idea is add like a buttom on top or somtimg like GetLink, so if i only load like 200 images i can get the source, i tride to append script but dont work,tride o add buttom dont work, some reason only way to work the script is when script is scrolling or after docoment redy but only work for fisrt images – yaelmania Jan 04 '19 at 20:53
  • You'd need to run the script every time you load more content. – Diodeus - James MacFarlane Jan 04 '19 at 20:54

0 Answers0