Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

trying to optimize picture preview for mobile

  • Loading branch information...
commit 22fbf754e665d81edee15d5975a49464bffc4f9b 1 parent d0229fd
@sukhada authored
Showing with 12 additions and 9 deletions.
  1. +12 −9 reddit.js
View
21 reddit.js
@@ -282,24 +282,27 @@ $("#clear").click(function() {
if ($(window).width() < 704) {
$(document).ready(function() {
var link = $(this).attr('href');
- if (link != undefined) {
- if (($(this).attr('href').indexOf("i.imgur") != -1) ||
- ($(this).attr('href').indexOf("jpg") != -1) ||
- ($(this).attr('href').indexOf("png") != -1) ||
- ($(this).attr('href').indexOf("gif") != -1)) {
- $('a').bind('touchstart touchend', function(e) {
- alert(this);
+ if (link != undefined) {
+ console.log('defined!');
+ $(document).on('touchstart touchend', 'a', function(e) {
+ if (($(this).attr('href').indexOf("i.imgur") != -1) ||
+ ($(this).attr('href').indexOf("jpg") != -1) ||
+ ($(this).attr('href').indexOf("png") != -1) ||
+ ($(this).attr('href').indexOf("gif") != -1)) {
+ console.log(this);
e.preventDefault();
$("#img").css("top", e.pageY - 10);
$("#img").css("left", 0);
console.log($("#img").css("left"));
$(this).css("color", "#05B8CC");
$("#img").append("<img class='image' src='"+ link +"'></img>");
- });
- }
+ }
+ });
}
+ localStorage.setItem("posts", $("#posts").html());
});
}
+
else {
$(document).on("mouseenter", "a", function(e) {
var link = $(this).attr('href');
Please sign in to comment.
Something went wrong with that request. Please try again.