Results 1 to 2 of 2

Thread: Show current page with sprite navigation.

  1. #1
    Join Date
    Dec 2010
    Posts
    8

    Show current page with sprite navigation.

    I currently use sprite navigation across most of the sites I work on.

    I was wondering if anyone knows any nice little tricks or has any video tutorial links to how to make a sprite navigation that shows what page the user is currently on. I've seen a few little bits of J Query on this, but nothing that really goes with what I'm looking for, or nothing that has a full tutorial.

    I'd really appreciate it if any of you guys could help me out!

    Thanks in advance!!

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    I can show you tutorials for a current page using images here:-
    http://www.wickham43.net/highlighthome.php
    The first two examples only use background-color, so look at the third example for a CSS solution or the fourth for a PHP solution.

    I haven't used a sprite, I used separate images, but it's simple to edit that.

    Everywhere that I have an image url in teh styles, like
    Code:
    background:url(images/navbuttongreen.gif) no-repeat 0px 0px;
    or
    Code:
    background:url(images/navbuttonorange.jpg) no-repeat 0px 0px;
    you would use one sprite image. You need an image with the normal situation on the left with the visited and hover states underneath and on the right you need the current page situation with visited and hover underneath, so it would be like
    http://www.wickham43.net/images/menuhomecombined.gif but with the three current page bits added to the right.

    In the code above 0px 0px; is the x position and y position, so you edit the y to move the background up or down for the visted and hover states and edit the x to set the current page positions, so current page visited and current page hover would have both x and y different from 0.

    Leave out the background-color from the styles if you don't have text over the background-images, or have the text off-screen.
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. Highlight current page in Navigation bar
    By pel in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 27 Nov 2010, 09:12 PM
  2. Problems getting the current page-link to be unique
    By Galrash in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 04 Aug 2010, 01:25 AM
  3. making sure most current page is the one displayed!
    By gocre8 in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 13 Mar 2006, 08:37 AM

Posting Permissions

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