Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

trying to optimize picture preview for mobile

  • Loading branch information...
commit 3b105eaf04b9a17a0eb626777491c84f94b18a05 1 parent 699d16a
Sukhada Kulkarni authored March 15, 2013

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  reddit.js
5  reddit.js
... ...
@@ -1,3 +1,4 @@
  1
+var t;
1 2
 var count;
2 3
 var counts = [];
3 4
 var result1 = [];
@@ -278,6 +279,8 @@ $("#clear").click(function() {
278 279
 
279 280
 $(document).on("mouseenter", "a", function(e) {
280 281
   var link = $(this).attr('href');
  282
+  clearTimeout(t);
  283
+  $("#img").empty();
281 284
   if (link != undefined) {
282 285
     if (($(this).attr('href').indexOf("i.imgur") != -1) || 
283 286
         ($(this).attr('href').indexOf("jpg") != -1) || 
@@ -295,7 +298,7 @@ $(document).on("mouseenter", "a", function(e) {
295 298
         $(this).css("color", "#05B8CC");
296 299
         $("#img").append("<img class='image' src='"+ link +"'></img>");
297 300
         console.log($(".image").css("width"));         
298  
-        setTimeout(function() {$("#img").empty();}, 3000);             
  301
+        t = setTimeout(function() {$("#img").empty();}, 3000);             
299 302
       }
300 303
     }  
301 304
   }

0 notes on commit 3b105ea

Please sign in to comment.
Something went wrong with that request. Please try again.