js tweaks

This commit is contained in:
Duncan Sommerville 2015-09-16 11:26:11 -04:00
parent 8dcea06077
commit 7006b55818
4 changed files with 34 additions and 38 deletions

View file

@ -289,20 +289,18 @@ function getUsabilityHint() {
});
}
function getPanTextFunctions() {
return {
mousein: function () {
var sw = $(this)[0].scrollWidth-parseFloat($(this).css("textIndent")), iw = $(this).innerWidth();
if (sw > iw) {
$(this).stop().animate({
textIndent: "-" + (sw + 1 - iw) + "px"
}, sw * 8);
}
},
mouseout: function () {
function setupTextScrolling(parent, selector) {
parent.on("mouseenter", selector, function () {
var sw = $(this)[0].scrollWidth - parseFloat($(this).css("textIndent")), iw = $(this).innerWidth();
if (sw > iw) {
$(this).stop().animate({
textIndent: "0"
}, 500);
textIndent: "-" + (sw + 1 - iw) + "px"
}, sw * 8);
}
}
});
parent.on("mouseleave", selector, function () {
$(this).stop().animate({
textIndent: "0"
}, 500);
});
}