frio: fix for display auto position scroll + some cleanup
This commit is contained in:
parent
c7eb7ba73f
commit
7e65d84577
3 changed files with 31 additions and 14 deletions
11
view/theme/frio/js/mod_display.js
Normal file
11
view/theme/frio/js/mod_display.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @brief Javascript for the display module
|
||||
*/
|
||||
|
||||
// Catch the GUID from the URL
|
||||
var itemID = window.location.pathname.split("/").pop();
|
||||
|
||||
$(document).ready(function(){
|
||||
// Scroll to the Item by its GUID
|
||||
scrollToItem(itemID);
|
||||
});
|
|
@ -542,3 +542,22 @@ String.prototype.rtrim = function() {
|
|||
var trimmed = this.replace(/\s+$/g, '');
|
||||
return trimmed;
|
||||
};
|
||||
|
||||
// Scroll to a specific item and highlight it
|
||||
// Note: jquery.color.js is needed
|
||||
function scrollToItem(itemID) {
|
||||
if( typeof searchValue === "undefined")
|
||||
return;
|
||||
|
||||
// Define the colors which are used for highlighting
|
||||
var colWhite = {backgroundColor:'#F5F5F5'};
|
||||
var colShiny = {backgroundColor:'#FFF176'};
|
||||
|
||||
// Scroll to the DIV with the ID (GUID)
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#item-'+itemID).position().top
|
||||
}, 400, function() {
|
||||
// Highlight post/commenent with ID (GUID)
|
||||
$('#item-'+itemID).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue