Results 1 to 3 of 3

Thread: TIP: simpler, css moo_modify_foreground.tpl

  1. #1
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default TIP: simpler, css moo_modify_foreground.tpl

    I am using moo_modify_foreground.tpl on a current project, but didn't like how it injected inline styling. This also negates the use of :hover and :focus styling. I came up with the following solution where these states are fully controlled by css: unselected, selected, hover/focus. Instead of injecting inline styling and requiring style changes to be made in the .tpl file, it simply injects an additional class for the selected toggler. Here is the complete code:

    Code:
    <script type="text/javascript">
    <![CDATA[//><!--
    window.addEvent('domready', function()
    {
    	new Accordion($$('div.toggler'), $$('div.accordion'), 
    	{
    		display: false,
    		alwaysHide: true,
    		opacity: true,
    
    		onActive: function(toggler)
    		{
    			toggler.addClass('togglerSelected');
    		},
    
    		onBackground: function(toggler)
    		{
    			toggler.removeClass('togglerSelected');
    		}
    	});
    });
    //--><!]]>
    </script>
    You will need to create css selectors for:
    .toggler
    .togglerSelected
    .toggler:hover, .toggler:focus
    .togglerSelected:hover, .togglerSelected:focus

    (The hover/focus are optional in both cases, but rounds things out nicely.)

  2. #2
    New user
    Join Date
    02-18-10.
    Location
    Greece
    Posts
    16

    Default Re: TIP: simpler, css moo_modify_foreground.tpl

    Thanks for the tip Ben,
    A link also would be nice when you are ready!

  3. #3
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: TIP: simpler, css moo_modify_foreground.tpl

    I've implemented it on a site I'm creating where the client does not want me link to the site until launch. I'll add a link here when I am able, though.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •