Ignore:
Timestamp:
2018-03-03T01:50:59+13:00 (6 years ago)
Author:
Georgiy Litvinov
Message:

Added navigation for search terms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r32072 r32157  
    1313var _onCells = new Array();
    1414
     15var curHLNum = 0;
    1516
    1617/*Array to store init states of metadata fields and text*/
     
    250251}
    251252
     253function scrollNextHightlight()
     254{
     255    if (curHLNum == null)
     256    {
     257        curHLNum = 0;
     258    } else
     259    {
     260        curHLNum++;
     261    }
     262    var hlNode = $("span[class$='ermHighlight']:eq(" + curHLNum + ")");
     263    if (hlNode.length == 0)
     264    {
     265        curHLNum = 0;
     266        hlNode = $("span[class$='ermHighlight']:eq(" + curHLNum + ")");
     267    }
     268    if (hlNode.length != 0)
     269    {
     270        var topVal = $(hlNode).offset().top - 50;
     271        $('html, body').stop().animate({scrollTop: topVal}, 1000);
     272    }
     273}
     274
     275function scrollPrevHightlight()
     276{
     277    if (curHLNum == null)
     278    {
     279        curHLNum = $("span[class$='ermHighlight']").length - 1;
     280    } else
     281    {
     282        curHLNum--;
     283    }
     284    var hlNode = $("span[class$='ermHighlight']:eq(" + curHLNum + ")");
     285    if (hlNode.length == 0)
     286    {
     287        curHLNum = $("span[class$='ermHighlight']").length - 1;
     288        hlNode = $("span[class$='ermHighlight']:eq(" + curHLNum + ")");
     289    }
     290    if (hlNode.length != 0)
     291    {
     292        var topVal = $(hlNode).offset().top - 50;
     293        $('html, body').stop().animate({scrollTop: topVal}, 1000);
     294    }
     295}
     296
    252297function focusSection(sectionID, level, tocDisabled)
    253298{
Note: See TracChangeset for help on using the changeset viewer.