Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mootools fix for triggerring load event #52

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions jquery.collagePlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,13 @@
* Assign the effect to show the image
* Default effect is using jquery and not CSS3 to support more browsers
* Wait until the image is loaded to do this
* Fix for Mootools: Instead of load replace it with custom trigger loadc
* on load force a loadc trigger
*
*/

$img
.one('load', function (target) {
.one('loadc', function (target) {
return function(){
if( settings.effect == 'default'){
target.animate({opacity: '1'},{duration: settings.fadeSpeed});
Expand All @@ -327,9 +329,17 @@
* fix for cached or loaded images
* For example if images are loaded in a "window.load" call we need to trigger
* the load call again
* Fix for Mootools: Manually triggerring load event causes problem if mootools library is present
* So instead of triggerring load we can trigger a custom event loadc and bind that trigger to either
* image complete (cached) or image load (non-cached) event
*/
.each(function() {
if(this.complete) $(this).trigger('load');
if(this.complete) $(this).trigger('loadc');
else{
$(this).one('load',function(){
$(this).trigger('loadc');
})
}
});

}
Expand Down
2 changes: 1 addition & 1 deletion jquery.collagePlus.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.