Jump to:

10845 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Lightwindow not working properly in IE!

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 7926 Views
  • lennie
    Avatar
    Community Member
    1 Post

    Re: Lightwindow not working properly in IE! Link to this post

    Yep I had the same issue and the 100% fix did not work. here is what to do

    Replace:

    this.checkImage = new PeriodicalExecuter(function(i) {
       if (!(typeof $('lightwindow_image_'+i).naturalWidth != "undefined" && $('lightwindow_image_'+i).naturalWidth == 0)) {

          this.checkImage.stop();

          var imageHeight = $('lightwindow_image_'+i).getHeight();
          if (imageHeight > this.resizeTo.height) {
             this.resizeTo.height = imageHeight;
          }
          this.resizeTo.width += $('lightwindow_image_'+i).getWidth();
          this.imageCount--;

          $('lightwindow_image_'+i).setStyle({
             height: '100%', width: '100%'
          });

          if (this.imageCount == 0) {
             this._processWindow();
          }
       }

    }.bind(this, i), 1);

    With:

       // We have to do this instead of .onload
    var ie = (document.all)?1:0;
    this.checkImage = new PeriodicalExecuter(function(i) {
       if(ie){ //THE BROWSER IS IE
          if ( $('lightwindow_image_'+i).complete && !(typeof $('lightwindow_image_'+i).naturalWidth != "undefined" && $('lightwindow_image_'+i).naturalWidth == 0)) {
             this.checkImage.stop();

             var imageHeight = $('lightwindow_image_'+i).getHeight();
             if (imageHeight > this.resizeTo.height) {
                this.resizeTo.height = imageHeight;
             }
             this.resizeTo.width += $('lightwindow_image_'+i).getWidth();
             this.imageCount--;

             $('lightwindow_image_'+i).setStyle({
                height: '100%', width: '100%'
             });

             if (this.imageCount == 0) {
                this._processWindow();
             }
             //alert('IE has been detected')
          }
       }
       else
       {//NOT IE, PROBABLY FF, OPERA, OTHER
          //this line works for all other browsers
          if ($('lightwindow_image_'+i).complete && !(typeof $('lightwindow_image_'+i).naturalWidth != "undefined" && $('lightwindow_image_'+i).naturalWidth == 0)) {

             this.checkImage.stop();

             var imageHeight = $('lightwindow_image_'+i).getHeight();
             if (imageHeight > this.resizeTo.height) {
                this.resizeTo.height = imageHeight;
             }
             this.resizeTo.width += $('lightwindow_image_'+i).getWidth();
             this.imageCount--;

             $('lightwindow_image_'+i).setStyle({
                height: '100%', width: '100%'
             });

             if (this.imageCount == 0) {
                this._processWindow();
             }
          }
       }

    }.bind(this, i), 1);   

    see this post
    http://www.rtraction.com/blog/devit/lightwindow-image-sizing-bug-in-ie6-on-first-click-of-gallery.html

    it will work now

  • danqxx
    Avatar
    Community Member
    14 Posts

    Re: Lightwindow not working properly in IE! Link to this post

    Good Job lennie,
    This code worked for me. Thanks for the expertise.

  • LoopyLarry
    Avatar
    Community Member
    4 Posts

    Re: Lightwindow not working properly in IE! Link to this post

    Just wanted to add that lennie's fix worked for me as well - I had lightwindow working with flickrservice in Firefox but not IE, but the fix works like a charm.

    Many thanks!

    7926 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.