Comments (11)
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.
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.
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.
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.
My script was included after jquery but not immediately after.
from jquery-resize.
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.
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.
MikeAmy's solution it's still working pretty good, thanks!
from jquery-resize.
What is the status of this issue? I am seeing the same error.
from jquery-resize.
@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.
MikeAmy's solution is useful. Thank you.
from jquery-resize.
Related Issues (20)
- Issues using .on(...) HOT 4
- Window resize not working when decreasing size
- Not resizing in IE on reduce, on a div
- TypeError: r is undefined HOT 2
- jquery-resize should use the native resize event in browsers which support it
- Permission Denied in at least IE8
- resize fire only once HOT 1
- [enhancement] Add missing bower.json. HOT 5
- Conflict with Highcharts + Flot HOT 5
- IOS Safari
- Add Bower Dependency HOT 1
- Serious memory leak HOT 1
- Promote a caretaker
- Issue with event delegation
- Handle 'data' null/undefined
- unbinding later bound event in earlier bound trigger fails
- resize and ui tabs HOT 4
- resize event on window is always triggered HOT 4
- CPU extreamly high when numerous elements are binded. Suggestion included. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-resize.