Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Small JS bump needed

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #42295
    bogus
    Participant

    Hey all,

    fiddled for several hours now but can’t find a solution to this simple thing.

    I got a fullscreen image that is put in by [backstretch.js](http://srobbin.com/jquery-plugins/backstretch/ “”). The preloader for this image is this:

    jQuery(function($){
    $(window).on(“backstretch.show”, function () {
    $(“#preload”).fadeOut(‘slow’);
    });
    });

    works fine.

    On another page i have an image stretched into a div with id=”letterbox” by backstretch.

    if i change (window) to (“#letterbox”) it does not work. Isn’t this the right approach?

    I’ll never get JS :(.

    #122597
    CarlRosell
    Participant

    i dont think that you can use the .on event here. if you go to there [homepage](http://srobbin.com/jquery-plugins/backstretch/ “homepage”) there is a section for using on block level elements. here is that code

    $(“#letterbox”).backstretch(“path to your image”);

    #122599
    bogus
    Participant

    Yes and that’s working quite well. I only need my preloader set so he knows when the image is isloaded inside the div.

    the backstretch itself is perfectly okay..

    #122611
    CarlRosell
    Participant

    Okay sorry. didnt read the question that well. can you post some screenshots or a codepen so i can se what the exact problem is? :)

    #122644
    bogus
    Participant

    yeah sure. I’ve put it up: [Tingeltangel](http://tingeltangel.megavillain.org/?p=59 “”)

    you see? the preloader image won’t fade. :(

    I think it’s only a small thing somehow…

    #122661
    CarlRosell
    Participant

    the only thing i could see was an extra . infront of backstretch. it sould be

    $(window).on(“backstretch.show”

    as it is now you are listening for the wrong event.
    hope that helped. i have no way to test if that’s working, but let me know.

    #122649
    bogus
    Participant

    That’s it. I’m embarrassed. Thank you, Carl!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.