[jQuery] Re: Image-Load

2009-09-09 Thread rupak mandal
use $(window).load. I think it will work

Thanks
Rupak

On Wed, Sep 9, 2009 at 3:13 PM, binarious mar...@simple-co.de wrote:


 Hey,
 I have an alert(); in a document.ready function. Sometimes the alert
 appears after my image on this page is loaded and sometimes it appears
 before. What can I do, that this javascript-part is really executed
 AFTER everything is loaded?

 Greeting from binarious



[jQuery] Re: Image load causing page refresh

2008-11-03 Thread fshuja

Perfect!
thnx a lot

On Nov 3, 4:14 pm, Mike Alsup [EMAIL PROTECTED] wrote:
  hi,
  I am creating a plugin for my gallery. I am loading image on click of
  a thumnail. thumnail's rel attribute contains the url of the larger
  image.
  In my pluging i have a method to load the clicked image.

  LoadSelectedImage = function(){
                  var src = $('gallery li.on a').attr('rel');
                  var img = new Image();
                  $('#testing').css({opacity: .5});
                  $(img).load(function () {
                          $(this).css({display: 'none'});
                          $('#loader').removeClass('loading');
                          $('#testing').empty();
                          $('#testing').css({opacity: 1});
                          $('#testing').append(this);
                          $(this).fadeIn(400);
                  }).error(function () {
                  }).attr('src', src).attr('id','gallery_img_container');
          }

  but when this method runs on click of the thumbnail, the whole page
  refreshes and the execution again start from
  $('#gallery1').Gallery();      //start the Gallery plugin

 You need to 'return false' from your click handler to prevent the
 default browser behavior.


[jQuery] Re: Image load causing page refresh

2008-11-03 Thread Mike Alsup

 hi,
 I am creating a plugin for my gallery. I am loading image on click of
 a thumnail. thumnail's rel attribute contains the url of the larger
 image.
 In my pluging i have a method to load the clicked image.

 LoadSelectedImage = function(){
                 var src = $('gallery li.on a').attr('rel');
                 var img = new Image();
                 $('#testing').css({opacity: .5});
                 $(img).load(function () {
                         $(this).css({display: 'none'});
                         $('#loader').removeClass('loading');
                         $('#testing').empty();
                         $('#testing').css({opacity: 1});
                         $('#testing').append(this);
                         $(this).fadeIn(400);
                 }).error(function () {
                 }).attr('src', src).attr('id','gallery_img_container');
         }

 but when this method runs on click of the thumbnail, the whole page
 refreshes and the execution again start from
 $('#gallery1').Gallery();      //start the Gallery plugin


You need to 'return false' from your click handler to prevent the
default browser behavior.