diff --git a/resp_img.js b/resp_img.js
index 784b7f8..f4a6d38 100644
--- a/resp_img.js
+++ b/resp_img.js
@@ -94,7 +94,15 @@
       // support for images
       $('img').each(function() {
         var img = $(this);
-        var src = img.attr('src').replace(current_suffix, suffix);
+        var orig_src = img.attr('src');
+        if (Drupal.settings.respImg.newUrls && Drupal.settings.respImg.newUrls[orig_src] && Drupal.settings.respImg.newUrls[orig_src][suffix]) {
+            var src = Drupal.settings.respImg.newUrls[orig_src][suffix];
+            Drupal.settings.respImg.newUrls[src] = Drupal.settings.respImg.newUrls[orig_src];
+            delete Drupal.settings.respImg.newUrls[orig_src];
+          }
+          else {
+           var src = orig_src.replace(current_suffix, suffix);
+         }
         img.attr('src', src);
         img.removeAttr('width');
         img.removeAttr('height');
diff --git a/resp_img.module b/resp_img.module
index 255be02..d3fff78 100644
--- a/resp_img.module
+++ b/resp_img.module
@@ -213,6 +213,13 @@ function resp_img_theme_registry_alter(&$theme_registry) {
         $theme_registry[$key]['preprocess functions'] = array('resp_img_pp_image');
       }
     }
+    if ($key == 'image_style') {
+      if (isset($theme_registry[$key]['preprocess functions']) && is_array($theme_registry[$key]['preprocess functions'])) {
+        array_unshift($theme_registry[$key]['preprocess functions'], 'resp_img_pp_image_style');
+      } else {
+        $theme_registry[$key]['preprocess functions'] = array('resp_img_pp_image_style');
+      }
+    }
     if ($key == 'field_slideshow') {
       if (isset($theme_registry[$key]['preprocess functions']) && is_array($theme_registry[$key]['preprocess functions'])) {
         array_unshift($theme_registry[$key]['preprocess functions'], 'resp_img_pp_field_slideshow');
@@ -246,13 +253,31 @@ function resp_img_pp_field_slideshow(&$variables) {
  */
 function resp_img_pp_image(&$variables) {
   resp_img_add_js();
-  if (isset($variables['style_name']) && $variables['style_name'] != resp_img_replace_suffix($variables['style_name'])) {
+}
+
+/**
+ * Support for image styles.
+ */
+function resp_img_pp_image_style(&$variables) {
+  resp_img_add_js();
+  $default_suffix = variable_get('resp_img_default_suffix', '');
+  if (isset($variables['style_name']) && (strpos($variables['style_name'], $default_suffix) !== FALSE)) {
     $variables['style_name'] = resp_img_replace_suffix($variables['style_name']);
-    $variables['path'] = resp_img_replace_suffix($variables['path']);
-    foreach (array('width', 'height') as $key) {
-      if (isset($variables[$key])) {
-        unset($variables[$key]);
-      }
+    // Add JavaScript settings for all possible suffixes for this image.
+    $settings = array();
+    $best_suffix = resp_img_get_best_suffix();
+    $image_url = image_style_url($variables['style_name'], $variables['path']);
+    foreach (array_keys(resp_img_suffix_load_all_breakpoints()) as $suffix) {
+      $style_name = str_replace($best_suffix, $suffix, $variables['style_name']);
+      // Suppress this module's altering of URLs before calling
+      // image_style_url(), since we want to know the real URL associated with
+      // the requested image style.
+      resp_image_suppress_file_url_alter(TRUE);
+      $settings['newUrls'][$image_url][$suffix] = image_style_url($style_name, $variables['path']);
+      resp_image_suppress_file_url_alter(FALSE);
+    }
+    if ($settings) {
+      drupal_add_js(array('respImg' => $settings), array('type' => 'setting', 'weight' => -11, 'group' => JS_DEFAULT));
     }
   }
 }
@@ -270,7 +295,22 @@ function resp_img_url_outbound_alter(&$path, &$options, $original_path) {
  * Alter all image sources.
  */
 function resp_img_file_url_alter(&$uri) {
-  $uri = resp_img_replace_suffix($uri);
+  if (!resp_image_suppress_file_url_alter()) {
+    $uri = resp_img_replace_suffix($uri);
+  }
+}
+
+/**
+ * Allows the altering of file URLs to be suppressed.
+ *
+ * @see resp_img_file_url_alter()
+ */
+function resp_image_suppress_file_url_alter($suppress = NULL) {
+  static $state = FALSE;
+  if (isset($suppress)) {
+    $state = $suppress;
+  }
+  return $state;
 }
 
 /**
