frio: highlight - use offset() instead of postion()
This commit is contained in:
parent
531cba5ce5
commit
cf23a81c33
|
@ -3,9 +3,9 @@
|
|||
*/
|
||||
|
||||
// Catch the GUID from the URL
|
||||
var itemID = window.location.pathname.split("/").pop();
|
||||
var itemGuid = window.location.pathname.split("/").pop();
|
||||
|
||||
$(document).ready(function(){
|
||||
// Scroll to the Item by its GUID
|
||||
scrollToItem(itemID);
|
||||
scrollToItem('item-'+itemGuid);
|
||||
});
|
||||
|
|
|
@ -553,11 +553,15 @@ function scrollToItem(itemID) {
|
|||
var colWhite = {backgroundColor:'#F5F5F5'};
|
||||
var colShiny = {backgroundColor:'#FFF176'};
|
||||
|
||||
// Get the Item Position (we need to substract 100 to match
|
||||
// correct position
|
||||
var itemPos = $('#'+itemID).offset().top - 100;
|
||||
|
||||
// Scroll to the DIV with the ID (GUID)
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#item-'+itemID).position().top
|
||||
scrollTop: itemPos
|
||||
}, 400, function() {
|
||||
// Highlight post/commenent with ID (GUID)
|
||||
$('#item-'+itemID).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000);
|
||||
$('#'+itemID).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 600);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue