WP Retina 2x
[resolved] Responsive Design Issue (2 posts)

  1. lkhulusi
    Posted 2 years ago #

    Hey Jordy,

    First of all, great plugin! Thanks so much for taking the time to make it.

    I noticed an issue on one of the sites I'm currently building where the @2x image actually has the width and heigh properties in the image tag. Because my site is responsive, having those attributes in the image messes with the functionality.

    I modified the code in your retina.js file as follows:

    RetinaImage.prototype.swap = function(path) {
        if (typeof path == 'undefined') path = this.path.at_2x_path;
        var that = this;
        function load() {
          if (! that.el.complete) {
            setTimeout(load, 5);
          } else {
            if (config.force_original_dimensions) {
              // that.el.setAttribute('width', that.el.offsetWidth);
              // that.el.setAttribute('height', that.el.offsetHeight);
            that.el.setAttribute('src', path);

    Do you think you might be able to create an option for the plugin so that original image sizing can be turned off for responsive designs where the developer has set up custom image sizes? I'm just worried that an update may overwrite this file in the future and I'll have to figure all this out again.



  2. Jordy Meow
    Plugin Author

    Posted 1 year ago #

    Actually the problem is that the client-side method uses an EXTERNAL script. Of course I could fork it and add options and all, but I prefer to concentrate on the core of the plugin, and the HTML Rewrite method (which is the only method developed 100% for WordPress).

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Retina 2x
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic