- Screen name: wick
wick's Profile
3 Posts
38 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 05-Nov-2011 05:13 PM
- Forum: Using jQuery
I'd like to switch any broken images in dynamically loaded HTML to a warning graphic, something like:- $(function() {
$('#alwayshere').on('error','img',function() {
$(this).prop('src','/img/404.png');
});
$('#alwayshere').append('<img src="/img/asdf.png" />');
});
Thanks in advance for any tips,
-Wick
--
http://www.CarComplaints.com- 20-Jan-2010 05:42 PM
- Forum: Using jQuery
As far as I can tell, animating natively inline elements was changed slightly in jQuery 1.4 -- I've been using CSS to set display: block on all form label elements, & I hide specific form labels using a more specific selector (example CSS below). Then I use jQuery to .slideDown() the hidden form labels when needed.
With jQuery 1.3.2, this method worked & the animated labels ended up with display: block set as an inline style after .slideDown() finished.- <style type="text/css">
form label { display: block; }
form label#test1,
form label#test2 { display: none; }
</style>
With jQuery 1.4, the animated label elements end up with display: inline (again, set as an inline style) after the animation ends.
Anyone know if this the intended behavior or is this a bug? Either way, I'm not sure how else to handle this without adding another container element around each form label I want to animate, & using the new container to handle animating the labels rather than using the labels themselves.
Example code: under jQuery 1.4 or jQuery 1.3.2
Thanks in advance for any help/suggestions.
-Wick- 17-Mar-2007 07:19 PM
- Forum: Using jQuery
I've run across what seems to be several inconsistencies using
.hide(...) as an animation, vs. the other base effects (jQuery 1.1.2).
I'd appreciate it if someone could shed some light on whether the
behavior is intended. Tested in FF2 & IE7, same behavior in both.
$('#myDiv').hide(300).show(300);
...doesn't seem to queue the effects, or maybe it does but there's a bug
in the final state of .hide(delay) so show() doesn't believe it's really
hidden? Unlike the other base effects, .show() & .hide() appear to test
the initial state of the object - see below. Flip-flopping the chained
methods to .show(300).hide(300) displays the queues effects as you would
expect. Next...
$('#myDiv').hide(300,function() {
alert('.');
});
...the callback function does not execute if #myDiv is already hidden.
Same behavior with .show(...) when the object is already visible. I can
see how that might be logical, but wasn't sure because it's a different
behavior from the other animation effects - the callback function
execution of the other base effects are not dependent on the object's
initial state.
Test page here: http://www.carcomplaints.com/show-hide-bug.html
Thanks,
-Wick
--
http://www.CarComplaints.com
What's wrong with YOUR car?
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/- «Prev
- Next »
Moderate user : wick
© 2013 jQuery Foundation
Sponsored by and others.

