www.webdeveloper.com
Results 1 to 8 of 8

Thread: page links to drop down menu

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Posts
    7

    page links to drop down menu

    I just created a horizontal drop down navigation bar in dreamweaver using CSS that I
    followed from a tutorial.

    The problem is: I have my navigation bar on all the pages - and I also created all my
    pages that correspond to the drop down links.

    They way I have linked pages in the past (with just a regular nav bar) is to highlight the text in the document and then in the Properties Panels dragged the 'little circle' icon to the page I want it to go to in the Files Panel.

    With this drop down menu - it is only in the code - so how do I link - lets say the HOME page to the page in the drop down menu ?

    Thank you.

  2. #2
    Join Date
    Mar 2013
    Posts
    7
    this is my code - and it isn't working. what am i doing wrong ?
    thank you.

  3. #3
    Join Date
    Mar 2013
    Posts
    7
    oops. here it is:

    <div id="navigation">
    <ul id="navmenu">
    <li><a href="index.php">HOME</a></li>
    <li><a href="aboutus.php">ABOUT</a></li>
    <li><a href="collections.php">COLLECTIONS</a>
    <ul class="sub1">
    <li><a href="mountain.php">MOUNTAIN</a></li>
    <li><a href="ocean.php">OCEAN</a></li>
    <li><a href="bohemian.php">BOHEMIAN</a></li>
    <li><a href="native.php">NATIVE</a></li>
    <li><a href="green.php">GREEN</a></li>
    <li><a href="moon.php">MOON</a></li>
    <li><a href="plants.php">PLANTS</a></li>
    </ul>
    </li>
    <li><a href="offerings.php">OFFERINGS</a>
    <ul class="sub1">
    <li><a href="seasons.php">SEASONS</a></li>
    <li><a href="installs.php">INSTALLS</a></li>
    <li><a href="storefront.php">STOREFRONT</a></li>
    <li><a href="lingerie.php">LINGERIE</a></li>
    </ul>
    </li>
    <li><a href="contact.php">CONTACT</a></li>
    <li><a href="order.php">ORDER</a></li>
    </ul>
    </div>

  4. #4
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,220
    Make sure paths are correct if menu on a page is outside a common directory.

    Absolute and Relative Paths: http://webdesign.about.com/od/beginn.../aa040502a.htm

  5. #5
    if are you facing any problem with dropdown menu, you can be find on google, there you will be get good code, i hope you will get best.

  6. #6
    Join Date
    Feb 2013
    Posts
    168
    Just think of a drop-down menu like a staircase going down.

    #nav
    #nav ul
    #nav ul li
    #nav ul li a
    #nav ul li a: hover

    drop-down
    #nav li ul
    #nav li ul li
    etc....

    I changed navigation to nav for I'm lazy added a little javascript (although I don't think it's necessary?) and I also used inline css styling. I would recommend using an external file for your css & javascript?


    Here's an example of your menu
    HTML Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Drop-Down Example</title>
    <style type="text/css">
    /* MAIN NAVIGATION 
    --------------------------------------*/
    #nav{ 
    	float: left;
    	width: 1000px;
    	height: 25px;
    	padding: 0px;
    	margin: 0px;
    }
    
    #nav ul {
    	list-style: none;
    	padding: 0px;
    	margin: 0px;
    }
    
    #nav ul li {
    	float: left;
    	width: auto;
    	padding: 0px;
    	margin: 0px;
    }
    
    #nav a {
    	display: block;
    	width: auto;
    	height: 25px;
    	background-color: #fbfbfb;
    	font-family: arial, helvetica, sans-serif;
    		font-size: 1.2em;
    		line-height: 25px;
    		font-weight: bold;
    		color: #bbb;
    	text-decoration: none;
    	padding: 0 75px 0 0;
    	margin: 0px;
    }
    
    #nav ul li a:hover {
    	color: #000;
    }
    
    
    /* DROPDOWN MENU - MAIN NAVIGATION
    -------------------------------------- */
    #nav li ul { 
    	width: 200px;
    	position: absolute;
    		left: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */
    	background-color: #fff;
    }
    
    #nav li ul li a {
    	width: 200px;
    	height: 20px;
    	font-weight: normal;
    	background-color: #fff;
    	border-bottom: 1px solid #ccc;
    	padding: 0px;
    	margin: 0px;	
    }
    
    #nav li:hover ul, #nav li.sfhover ul { /* javascript IE fix */
    	left: auto;
    	width: 200px;
    }
    
    
    </style>
    <script type="text/javascript">
    	sfHover = function() {
    		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    		for (var i=0; i<sfEls.length; i++) {
    			sfEls[i].onmouseover=function() {
    				this.className+=" sfhover";
    			}
    			sfEls[i].onmouseout=function() {
    				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    			}
    		}
    	}
    	if (window.attachEvent) window.attachEvent("onload", sfHover);
    </script>
    </head>
    
    <body>
    <div id="nav">
      <ul>
        <li><a href="index.php">HOME</a></li>
        <li><a href="aboutus.php">ABOUT</a></li>
        <li><a href="collections.php">COLLECTIONS</a>
          <ul>
            <li><a href="mountain.php">MOUNTAIN</a></li>
            <li><a href="ocean.php">OCEAN</a></li>
            <li><a href="bohemian.php">BOHEMIAN</a></li>
            <li><a href="native.php">NATIVE</a></li>
            <li><a href="green.php">GREEN</a></li>
            <li><a href="moon.php">MOON</a></li>
            <li><a href="plants.php">PLANTS</a></li>
          </ul>
        </li>
        <li><a href="offerings.php">OFFERINGS</a>
          <ul>
            <li><a href="seasons.php">SEASONS</a></li>
            <li><a href="installs.php">INSTALLS</a></li>
            <li><a href="storefront.php">STOREFRONT</a></li>
            <li><a href="lingerie.php">LINGERIE</a></li>
          </ul>
        </li>
        <li><a href="contact.php">CONTACT</a></li>
        <li><a href="order.php">ORDER</a></li>
      </ul>
    </div>
    </body>
    </html>

  7. #7
    Join Date
    Feb 2013
    Posts
    168
    I notice you are using php, you can even do this dynamically (although this is old code, I would convert it to mysqli or PDO):

    PHP Code:
        function navigation($sel_subject$sel_page$public false) {
            
    $output "<ul class=\"subjects\">";
            
    $subject_set get_all_subjects($public);
            while (
    $subject mysql_fetch_array($subject_set)) {
                
    $output .= "<li";
                if (
    $subject["id"] == $sel_subject['id']) { $output .= " class=\"selected\""; }
                
    $output .= "><a href=\"edit_subject.php?subj=" urlencode($subject["id"]) . 
                    
    "\">{$subject["menu_name"]}</a></li>";
                
    $page_set get_pages_for_subject($subject["id"], $public);
                
    $output .= "<ul class=\"pages\">";
                while (
    $page mysql_fetch_array($page_set)) {
                    
    $output .= "<li";
                    if (
    $page["id"] == $sel_page['id']) { $output .= " class=\"selected\""; }
                    
    $output .= "><a href=\"content.php?page=" urlencode($page["id"]) .
                        
    "\">{$page["menu_name"]}</a></li>";
                }
                
    $output .= "</ul>";
            }
            
    $output .= "</ul>";
            return 
    $output;
        } 

  8. #8
    Join Date
    Apr 2013
    Posts
    1
    <form>
    <label><u>S</u>earch Engines</label>
    <select accesskey="S" onchange="goToPage(this.options(this.selectedIndex).value)">
    <option selected>Please select one</option>
    <option value="http://search.msn.com/">MSN Search</option>
    <option value="http://www.google.com/">Google</option>
    <option value="http://www.search.com/">Search.com</option>
    <option value="http://www.dogpile.com/">Dogpile</option>
    </select>
    form>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.15805 seconds
  • Memory Usage 3,159KB
  • Queries Executed 13 (?)
More Information
Template Usage (31):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (27):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./includes/functions_threadedmode.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (71):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates