Git Product home page Git Product logo

Comments (11)

MikeAmy avatar MikeAmy commented on August 20, 2024 2

Maybe this would be better:

function new_handler( e, w, h ) {
        var elem = $(this),
          data = $.data( this, str_data );
          if (!data) {
              data = $.data( this, str_data, {})
          }

          // If called from the polling loop, w and h will be passed in as
          // arguments. If called manually, via .trigger( 'resize' ) or .resize(),
          // those values will need to be computed.
          data.w = w !== undefined ? w : elem.width();
          data.h = h !== undefined ? h : elem.height();

        old_handler.apply( this, arguments );
      };

from jquery-resize.

fluxsaas avatar fluxsaas commented on August 20, 2024

and the solution seems to be:

- public/javascripts/lib/jquery.js
- public/javascripts/lib/jquery-ui.js
- public/javascripts/plugins/jquery.ba-resize.js

embedding the plugin right after jquery. previously i had it at the end of my plugin list... not sure if it is still a bug...

from jquery-resize.

betalb avatar betalb commented on August 20, 2024

It happens if you bind resize events before ba-resize is loaded, so this event won't get data
In my case this happend when I binded first resize event to window object before ba-resize was loaded.

from jquery-resize.

MikeAmy avatar MikeAmy commented on August 20, 2024

I had changed new_handler but this is probably hacky...

    ...
    function new_handler( e, w, h ) {
        var elem = $(this),
          data = $.data( this, str_data );
          // added this bit
          if (!data) {
              data = $.data( this, str_data, { w: elem.width(), h: elem.height() })
          }
          else {

            // If called from the polling loop, w and h will be passed in as
            // arguments. If called manually, via .trigger( 'resize' ) or .resize(),
            // those values will need to be computed.
            if (w !== undefined) {
                data.w = w
            }
            else {
                data.w = elem.width();
            }
            data.h = h !== undefined ? h : elem.height();
          }

        old_handler.apply( this, arguments );
      };

from jquery-resize.

MikeAmy avatar MikeAmy commented on August 20, 2024

My script was included after jquery but not immediately after.

from jquery-resize.

orangewarp avatar orangewarp commented on August 20, 2024

I had a similar issue but it wasn't because the plugin wasn't loaded. (Using require.js) The above patch by MikeAmy seems to have fixed my problem.

from jquery-resize.

tobiaz avatar tobiaz commented on August 20, 2024

MikeAmy's solution above also fixed my issue of "data" being undefined. Insert the if block:

if (!data) {
              data = $.data( this, str_data, {})
          }

after line 193 in jquery.ba-resize.js.

from jquery-resize.

adanarchila avatar adanarchila commented on August 20, 2024

MikeAmy's solution it's still working pretty good, thanks!

from jquery-resize.

thecountofzero avatar thecountofzero commented on August 20, 2024

What is the status of this issue? I am seeing the same error.

from jquery-resize.

roelvanduijnhoven avatar roelvanduijnhoven commented on August 20, 2024

@tobiaz fix also fixes my problems.

But I just found out that the last commit to this repo was 4 years ago: so I am abonding it.

from jquery-resize.

killa1218 avatar killa1218 commented on August 20, 2024

MikeAmy's solution is useful. Thank you.

from jquery-resize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.