[Mediawiki-l] Change logo on hover

Jim Wilson wilson.jim.r at gmail.com
Wed Nov 14 19:47:31 UTC 2007


> I don't see any obvious reason why the logo is set as a
> background image inline in monobook.php rather than in
> common.css. I suspect that if there is a reason it would also
> explain why what I'm trying to do is not working.

I do not speak for the MW maintainers, but I believe this is to
explicitly prevent the logo from being changable via
[[MediaWiki:Monobook.css]] and [[MediaWiki:Common.css]].  That is,
that changing the logo requires actual back-end access, not simply a
sysop account on the wiki.

What follows is one solution to what you are trying to do - I cannot
help you any more than giving you the exact solution:

1) In an un-altered Monobook.php, locate and remove the style
attribute on the <a> tag under the p-logo div.

2) Add this to the article [[MediaWiki:Monobook.css]]:

 #p-logo a {
   background-image: url(http://server/path/to/regular-logo.gif);
 }

 #p-logo a:hover {
   background-image: url(http://server/path/to/hover-logo.gif);
 }

That's all it takes.  I have tested this in a vanilla MW 1.9.3
install. Good luck!

-- Jim

On 11/13/07, James Sweet <james at educationarchitects.com> wrote:
> Yes, as I said earlier I added the img link to monobook.php, and I also
> modified the a and a:hover properties in main.css. The reason I did so is
> because I want to have a different image on hover. Here is an example (not
> the images I'm actually using for a logo):
>
> http://www.clickthink.net/HoverLogo/
>
> The only way I'm aware to do this is to link to a transparent image and set
> the background-image for a and a:hover to the appropriate logos, which is
> what I did. That did not work, however, and my question was does anyone know
> what the problem might be?
>
> As long as we're on the subject of separating style and content, I don't see
> any obvious reason why the logo is set as a background image inline in
> monobook.php rather than in common.css. I suspect that if there is a reason
> it would also explain why what I'm trying to do is not working.
>
> Best,
> Jim
>
>
> -----Original Message-----
> From: mediawiki-l-bounces at lists.wikimedia.org
> [mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf Of Jim Wilson
> Sent: Monday, November 12, 2007 2:54 PM
> To: MediaWiki announcements and site admin list
> Subject: Re: [Mediawiki-l] Change logo on hover
>
> > How do you propose to create a link without an img tag, ...
>
> Again, as Platonides said, the img tag didn't exist prior to you
> putting it there, and the link worked just fine.
>
> > state-dependent styles cannot be handled inline?
>
> You're correct that you can't represent state-dependent styles via an
> inline style declaration - which is why I said you should remove the
> inline background declaration and put it all in
> [[MediaWiki:Common.css]] or [[MediaWiki:Monobook.css]].
>
> -- Jim R. Wilson (jimbojw)
>
>
> On Nov 11, 2007 9:10 PM, James Sweet <james at educationarchitects.com> wrote:
> > How do you propose to create a link without an img tag, given that
> > state-dependent styles cannot be handled inline?
> >
> > -----Original Message-----
> > From: mediawiki-l-bounces at lists.wikimedia.org
> > [mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf Of Platonides
> > Sent: Sunday, November 11, 2007 4:43 PM
> > To: mediawiki-l at lists.wikimedia.org
> > Subject: Re: [Mediawiki-l] Change logo on hover
> >
> >
> > James Sweet wrote:
> > > If you remove the style attribute and don't add an image source, then
> > there
> > > is no image at all in the anchor and therefore nothing to click on.
> That's
> > > why the transparent image is needed. It's actually what provides the
> link,
> > > but only the two background images can actually be seen.
> >
> > The monobook didn't have an <img tag before you added it. It's not
> > really needed.
> >
> >
> > _______________________________________________
> > MediaWiki-l mailing list
> > MediaWiki-l at lists.wikimedia.org
> > http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> >
> >
> > _______________________________________________
> > MediaWiki-l mailing list
> > MediaWiki-l at lists.wikimedia.org
> > http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>



More information about the MediaWiki-l mailing list