Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7677069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:20:26+00:00 2026-05-31T17:20:26+00:00

I am trying to use the jQuery plugin: Floating boxes with easing and motion-blur

  • 0

I am trying to use the jQuery plugin: Floating boxes with easing and motion-blur in jQuery By: Marcell Jusztin.

I have it working just fine and understand how to tweak most attributes, but I am a Javascript rookie and really do not understand the mechanics involved in changing how it uses math to place the elements I want to animate. What I want to do is change the set x and y offset coordinates (which are in pixels of course) to a set of percentages so that the elements will dynamically scale in position based on screen resolution. Here is the script in its entirety:

jQuery.fn.floatingBox = function ( userOptions ) {

options = jQuery.extend ({
    parent    : 'backdrop',
    stage     : 'backdrop',
    scale     : 0.3,
    xOffset   : 0,
    yOffset   : 0,
    blur      : false,
    isText    : false,
    blurColor : '#888',
    frameRate : 40,
}, userOptions);


var parent = options.parent;
var stage = options.stage;
var scale = options.scale;
var xOffset = options.xOffset;
var yOffset = options.yOffset;
var blur = options.blur;
var isText = options.isText;
var blurColor = options.blurColor;
var frameRate = options.frameRate;

var midX = $('#' + stage).width() / 2;
var midY = $('#' + stage).height() / 2;
var _x = midX;
var _y = midY;
var xx = midX;
var yy = midY;

var objectId = $(this).attr('id');
$('#' + objectId).css('position','absolute');

shadowAmount = 0;

window["timer" + objectId] = window.setInterval(update,frameRate);


$('#' + parent).mousemove(function(event){

    _x = event.pageX; 
    _y = event.pageY;

    if( shadowAmount < 5 && blur == true ) shadowAmount += scale;

});

factor = scale * 0.5;   

function update() {

        xx += (((_x - midX) * -scale) - xx) * factor;
        yy += (((_y - midY) * -scale) - yy) * factor;
        $('#' + objectId).css('left', xx + xOffset + $('#' + parent).position().left);
        $('#' + objectId).css('top', yy + yOffset + $('#' + parent).position().top);
        if(blur){
            if(!isText){
                $('#' + objectId).css('box-shadow', '0px 0px ' + shadowAmount + 'px ' + blurColor );
                $('#' + objectId).css('-moz-box-shadow', '0px 0px ' + shadowAmount + 'px ' + blurColor );
                $('#' + objectId).css('-webkit-box-shadow', '0px 0px ' + shadowAmount + 'px ' + blurColor );
                $('#' + objectId).css('-o-box-shadow', '0px 0px ' + shadowAmount + 'px ' + blurColor );
            }else{
                $('#' + objectId).css('text-shadow', '0px 0px ' + shadowAmount + 'px ' + blurColor );
            }
            if(shadowAmount > 0 ) shadowAmount -= scale;
        }


}

}

Here is the script that initiates the javascript in the HTML document:

<script type="text/javascript">

jQuery(function(){

        $('#biglogo').floatingBox({ 
            scale : 0.09,
            blur : false,
            isText : false,
            xOffset : 400,
            yOffset: 200,
        });

            $('#biglogo2').floatingBox({    
            scale : 0.08,
            blur : false,
            isText : false,
            xOffset : 405,
            yOffset: 205,
        });
    });
</script>

I have two transparent png files that are layered over each other with a minor offset of 5 pixels (or maybe its considered 10), but would rather the two images be centered in all browser windows and not just mine. The scale indicates how fast and far the elements move. The xOffset and yOffset parameters are of course fixed numbers that don’t scale based on browser window size.

I have attempted to research this but ultimately, I’m neither finding that it can’t be done, nor that it can because no one response seems to address the specific issue I am having. Perhaps I am not wording it correctly.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:20:27+00:00Added an answer on May 31, 2026 at 5:20 pm

    From the looks of the script I would say that it already takes the necessary calculations into accout. Try setting the parent and stage options and leave out the offset parameters. I.e

    $('#biglogo').floatingBox({ 
        parent: 'container-id',
        stage: 'container-id',
        scale: 0.09,
        blur: false,
        isText: false
    });
    

    Edit: I created a fiddle with some modifications to the plugin that shows how to get centering working, http://jsfiddle.net/wwBJt/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I am trying to use JQuery's URL Validator plugin. http://docs.jquery.com/Plugins/Validation/Methods/url I have a
Trying to use JQuery Easing plugin in my wordpress but its giving me following
I have a scenario where-in I am trying to use the jQuery template plugin
I'm trying to use the Jquery validation plugin to validate my form. I have
I'm trying to use the jQuery autocomplete plugin. I have an array of IDs
I'm trying to use jQuery.scrollTo plugin with accordion (where one block expands after clicking
I am trying to use jquery autocomplete plugin, I want it to suggest ItemCodes
I am trying to use this jQuery plugin (jsTree) in one of my project.
I'm trying to use the jquery flot graphing plugin with asp.net mvc. I'm trying
Im trying to use this page slider jquery plugin, you can see the demo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.