Skip to content

Commit

Permalink
trying to optimize picture preview for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name Here committed Mar 15, 2013
1 parent d0229fd commit 22fbf75
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions reddit.js
Expand Up @@ -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');
Expand Down

0 comments on commit 22fbf75

Please sign in to comment.