11
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/16 0:14

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


I`v found smth like what i`v looking for, but ones again - damn(sorry), i could not get it working properly on XOOPS theme, how to implement it in theme - link in studio the JS script can be downloaded at end of the page...

12
Burning
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/16 8:36

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi,

Keep <div id="<{$xoops_dirname}>"> ... </div>

And try this :

1. Edit your style.css and replace : #mainmenu by .mainmenu

2. Edit your block template : modules/system/templates/blocks/system_block_mainmenu.html.
Replace :
<td id="mainmenu">

By :
<td class="mainmenu">



3. Add in style.css this new code
#system .mainmenu a {color: red;}
#news .mainmenu a {color: red;}
#mylinks .mainmenu a {color: red;}
#oledrion .mainmenu a {color: red;}
#... .mainmenu a {color: red;}

(#your-module-folder-name)


Hope it works
Still learning CSS and... english

13
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/16 23:58

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


2Burning... replacing id by class that you described not working to... I don't know what to do...
Resized Image

14
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/25 23:23

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


And ones again ! Good day comrades! Mostly Iv found the Decision of that problem! Its the java+CSS... but once again - damn(sorry)! it works not such perfectly as I expects! it highlights the current link when you browsing entire site, but when you opening the home page or some modules that script highlights entire the whole menu... here it is - water.info.tm (all content on Russian)
here is the code of JS (inserts before the HEAD tags closes </head>)
<!-- highlight script-->
<
SCRIPT LANGUAGE="JavaScript">
<!--
function 
highlightLink()
{
    
//Get filename from the URL
    
thisPage document.URL.substring(document.URL.lastIndexOf("/")+,document.URL.length);
    
    
//Loop through all the links
    
for (i=0i<document.links.lengthi++ )
    {
        
//Get only the filename from the href of navigation link
        
pageLink document.links[i].href.substring(document.links[i].href.lastIndexOf("/")+,document.links[i].href.length);
        
        
//if the current filename & the link-ed file name are the same, change the background color of that link
        
if (thisPage == pageLink)
        {    
            
//BG is the name of a class that I have defined, that sets background color to grey
            
document.links[i].className "BG";
        }
        
    }
}
//-->
</SCRIPT>
<!-- 
highlight script-->


here is a part of CSS

/* highlight styles */
.BG {colorredfont:bolderlarger, ;}
/* Highlight styles */

15
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/29 11:07

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


IS ENY BODY HERE!?
It was soo close, but now its too far...
and I had to use Trabis decison...

16
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2009/1/8 16:09

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


Goood day comrades XOOPERS!
All done! all was so damn(sorry) simple as it could be!
Look at at my previous post... and find the correction...
here is a correct variant of script -
<!-- highlight script-->
<
SCRIPT LANGUAGE="JavaScript">
<!--
function 
highlightLink()
{
    
//Get filename from the URL
    
thisPage document.URL.substring(document.URL.lastIndexOf("%")+,document.URL.length);
    
    
//Loop through all the links
    
for (i=0i<document.links.lengthi++ )
    {
        
//Get only the filename from the href of navigation link
        
pageLink document.links[i].href.substring(document.links[i].href.lastIndexOf("%")+,document.links[i].href.length);
        
        
//if the current filename & the link-ed file name are the same, change the background color of that link
        
if (thisPage == pageLink)
        {    
            
//BG is the name of a class that I have defined, that sets background color to grey
            
document.links[i].className "BG";
        }
        
    }
}
//-->
</SCRIPT>
<!-- 
highlight script-->
</
head>
<
body id="<{$xoops_dirname}>" class="<{$xoops_langcode}>" onload="highlightLink()">

insert it as is in your theme and add to your CSS

/* highlight styles */
.BG {color#FF0000;}
/* Highlight styles */

the decision was so close as i said...
and here is the key - just looked at the JS closely and changed
href.lastIndexOf("/")+1
to
href.lastIndexOf("%")+1


the result could be seen herehttp://water.info.tm

thanks to every one for your replies and suggestions...
________________________________________
with best regards and wishes Happy hollydays xoopers...

Login

Who's Online

130 user(s) are online (70 user(s) are browsing Support Forums)


Members: 0


Guests: 130


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits