Skip to content

[jQuery] bgFlow plugin

by hezad on April 3rd, 2010

bgFlow est un plugin jQuery affichant une image d’arrière plan, se déplaçant en fonction de la position du curseur. L’image est chargée dynamiquement et quelques options permettent de modifier le mouvement de l’image.

bgFlow is a jQuery plugin that displays a background image moving with your cursor’s position. Image is loading dynamically and some options let you customize the movement.

Important : This plugin is not developped anymore. There is a known bug with chrome. But this is open source ! Anyone is encouraged to try stuff with the plugin’s code.

Important (2): Since this plugin sets the body of the document to “overflow: hidden” to disable scrollbars, it is NOT made for scrollable webpages.

Version : 1.1
Browser compatibility : Firefox 3, IE 8, Safari 3, Opera 9
License : GPL

Dependencies

Files

Usage

$(‘#a_div_on_the_page’).bgFlow({image:’your_image.jpg’});

Options

waitForStop (default : false) : Waits for the end of the movement to move content
speed (default : 400) : Speed of movement when waitForStop is set to true
opacity (default : 1) : Well … Opacity !

Update : A bug was discovered and fixed by alex (see comments below), thanks !

From → c0de

16 Comments
  1. anonym permalink

    hi,

    found jour plugin in the plugin section of the official jquery page. it was exactly the right thing i was looking for – and i think it is still unique out there. i want to thank you very much.

    greetings from germany

  2. hezad permalink

    Thanks for your comment :) ‘glad you liked it ;)

  3. alex permalink

    Hello! nice plugin!
    But its not working in Opera 10.6 and 10.5 could you please look whats wrong whith it?

  4. hezad permalink

    Well you worked faster than I :) Thanks for the fix you mailed me, the code has been updated and you’re in the thanks section of the library.

  5. Hey buddy, thanks for sharing the script, it works nicely.

    I’m wondering how to toggle the effect… I’m developing a new version of my portfolio and used your script to load a larger foto with z-index: 100;… so I gotta close the “zoomed image” so user can keep navigating the page.

    I’m trying something like this but it’s not working in loop, after click sometimes, I have to reload the page so it works again.

    $(‘#jFlow-bg-img’).click(function() {
    imTag.animate({‘opacity’: 0}, 400, function() {
    $(‘#jFlow-bg-img’).css(‘display’,'none’);
    $(‘.jflow’).css(‘display’,'none’);
    });
    });

    Could you help me?

    Thanks, cheers!
    Leo

  6. hezad permalink

    Hi Leo, I hope I understood well :)

    Try that :

    $(document).ready(function(){
    	$('.flow').bgFlow({image:'sun.jpg'});
    
    	$(document).click(function() {
    		var t = $('#jFlow-bg-img');
    
    		t.animate({'opacity':'0'},400,function(){ t.hide() });
    	});
    });
    
  7. Got it Hezad, merci, didn’t realise I had to t.hide()… thanks a lot.
    I tell you when the site is up.

  8. hezad permalink

    Glad it works :)

    don’t hesitate to tell me when your site is up !

    Pierrick.

  9. Hiya Hezad,

    i really like this background option, i want to show some of my pictures on the background.
    What i very much like is that the picture also scales with the browserwindow and that there can be a photoslide of pictures playing.
    Much to ask, but do you know of any?

    Thanks a lot for so far!

  10. hezad permalink

    Hey, Pete,

    I don’t have any plugin in mind right now but I’ll post here if I think about one in particular. :)

  11. PeteFriday permalink

    Well, i’ve been lookin’around for sometime now. Your bgFlow plugin looks best because of the interaction with the mouse. Really, really love it.
    One minor thing i found out is that it does’nt work in older browsers and when you resize the browserwindow the picture “falls a bit off” the screen.
    Well it’s easy to say what’s wrong and i don’t even know how to code at all (except for css en html)…
    Probably would be much more help if i could help improve the code. Sorry dude.

    Is’nt there a way to insert a browser scalling option and a photoslide in to this script? You would score big time with it i think…
    Well looks like i’m trying to convince you re-writting this script :-O

    Thx a zillion

  12. hezad permalink

    Thanks for the interest you’re showing, it’s always a pleasure :)

    The point is I *should* add more functionnalities and fix some minor bugs (like what you’re mentionning about window resizing) but I really don’t have time now. Anyway, if you want to modify the plugin, don’t hesitate to mess with the code, you’ll need some basics in javascript/jquery but I think the code is pretty easy to understand once you get how plugins work.

    About the question “Is’nt there a way to insert a browser scalling”, I’d say, try some stuff with $(document).resize() or $(window).resize()
    For more informations about those functions, the official jquery website has a pretty complete documentation ;)

  13. Johnny permalink

    This doesn’t work with Chrome? In the demo, the image is stuck to the cursor.

  14. Shaun permalink

    Hi Hezad,

    Thanks for making this great plugin. I’ve noticed a bug that’s seemed to have developed for this on Google Chrome on PC (Chrome on Mac seems to be fine.)

    Instead of the background sliding in an inverted fashion in response to the cursor’s positions, it seems that the background now just follows it.

    The problem seems exclusive to just Chrome, as I tried it out in Safari and it seems to work fine there, so I’m pretty sure it’s not a webkit problem…

    Thanks so much for developing this!

  15. hezad permalink

    Hi Shaun,

    You’re not the first noticing me about this bug.
    Unfortunately, i stopped to develop this plugin months ago. Anyway, it’s open source, if you know jQuery a bit, don’t hesitate to try stuff with the plugin’s source.

    Thanks a lot for your kinds words

  16. hezad permalink

    Yep, apparently, you’re not the only one impacted with this bug. the point is I stopped to develop this plugin. Anyway, you’re encouraged to try stuff with the plugin’s source if you want and/or can.

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

Spam protection by WP Captcha-Free