Created
February 15, 2016 10:01
-
-
Save Tusko/f6bb285d28815c45db0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gallery scroll | |
var gScroll = $('#gallery .row .gscroll'); | |
function gLoop(){ | |
var gHeight = gScroll.height() - $('#gallery').height(), | |
gTop = parseInt(gScroll.position().top * -1, 10); | |
if(gTop <= gHeight) { | |
gScroll.stop().animate({top:'-=10'}, 25, 'linear', gLoop); | |
} | |
} | |
function gLoopReverse(){ | |
var gTop = parseInt(gScroll.position().top, 10); | |
if(gTop < 0) { | |
gScroll.stop().animate({top:'+=10'}, 25, 'linear', gLoopReverse); | |
} | |
} | |
function gStop(){ | |
gScroll.stop(); | |
} | |
if(mob){ | |
$('#gallery .row .alignright > div.gs-down').on('touchstart', gLoop); | |
$('#gallery .row .alignright > div.gs-up').on('touchstart', gLoopReverse); | |
$('#gallery .row .alignright > div').on('touchend', gStop); | |
} else { | |
$('#gallery .row .alignright > div.gs-down').hover(gLoop, gStop); | |
$('#gallery .row .alignright > div.gs-up').hover(gLoopReverse, gStop); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment