www.webdeveloper.com
Results 1 to 4 of 4

Thread: cant center alignment on css/jquery menu

  1. #1
    Join Date
    Jan 2014
    Posts
    2

    cant center alignment on css/jquery menu

    hi people,

    first off, im not a specialist in website creation. i can however create a simple website very easily. but simple is not what we are after, is it?

    how i work is pretty simple, i download a template and suit it to my personal needs (im not selling websites or have any profit for it, its for my own professional activitities): i download a template i like and start customizing it to suit my needs.

    recently i found this cool looking css with jquery, in which i got stuck trying to center the drop down menu (i dont have the time necessary to really look in to it, concentrate on it).
    as far as i understand, a new jquery "ul" needs to added, but i dont have a clue where and how to do that.

    does any of you have an idea?

    i included the relevant code.

    thanks in advance for any helpful answer


    index.html:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Slide Down Box Menu with jQuery and CSS3</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="description" content="Slide Down Box Menu with jQuery and CSS3" />
    <meta name="keywords" content="jquery, css3, sliding, box, menu, cube, navigation, portfolio, thumbnails"/>
    <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
    <style>
    body{
    background:#333 url(bg.jpg) repeat top left;
    font-family:Arial;
    }
    span.reference{
    position:fixed;
    left:10px;
    bottom:10px;
    font-size:12px;
    }
    span.reference a{
    color:#aaa;
    text-transform:uppercase;
    text-decoration:none;
    text-shadow:1px 1px 1px #000;
    margin-right:30px;
    }
    span.reference a:hover{
    color:#ddd;
    }
    ul.sdt_menu{
    margin-top:150px;
    }
    h1.title{
    text-indent:-9000px;
    background:transparent url(title.png) no-repeat top left;
    width:633px;
    height:69px;
    }
    </style>
    </head>

    <body>
    <div class="content">
    <h1 class="title">Slide Down Box Menu with jQuery and CSS3</h1>
    <ul id="sdt_menu" class="sdt_menu">
    <li>
    <a href="#">
    <img src="images/2.jpg" alt=""/>
    <span class="sdt_active"></span>
    <span class="sdt_wrap">
    <span class="sdt_link">About me</span>
    <span class="sdt_descr">Get to know me</span>
    </span>
    </a>
    </li>
    <li>
    <a href="#">
    <img src="images/1.jpg" alt=""/>
    <span class="sdt_active"></span>
    <span class="sdt_wrap">
    <span class="sdt_link">Portfolio</span>
    <span class="sdt_descr">My work</span>
    </span>
    </a>
    <div class="sdt_box">
    <a href="#">Websites</a>
    <a href="#">Illustrations</a>
    <a href="#">Photography</a>
    </div>
    </li>
    <li>
    <a href="#">
    <img src="images/3.jpg" alt=""/>
    <span class="sdt_active"></span>
    <span class="sdt_wrap">
    <span class="sdt_link">Inspiration</span>
    <span class="sdt_descr">Where ideas get born</span>
    </span>
    </a>
    </li>
    <li>
    <a href="#">
    <img src="images/4.jpg" alt=""/>
    <span class="sdt_active"></span>
    <span class="sdt_wrap">
    <span class="sdt_link">Photos</span>
    <span class="sdt_descr">I like to photograph</span>
    </span>
    </a>
    </li>
    <li>
    <a href="#">
    <img src="images/5.jpg" alt=""/>
    <span class="sdt_active"></span>
    <span class="sdt_wrap">
    <span class="sdt_link">Blog</span>
    <span class="sdt_descr">I write about design</span>
    </span>
    </a>
    </li>
    <li>
    <a href="#">
    <img src="images/6.jpg" alt=""/>
    <span class="sdt_active"></span>
    <span class="sdt_wrap">
    <span class="sdt_link">Projects</span>
    <span class="sdt_descr">I like to code</span>
    </span>
    </a>
    <div class="sdt_box">
    <a href="#">Job Board Website</a>
    <a href="#">Shopping Cart</a>
    <a href="#">Interactive Maps</a>
    </div>
    </li>
    </ul>
    </div>
    <div>
    <span class="reference">
    <a href="http://tympanus.net/codrops/2010/07/16/slide-down-box-menu/">back to the Codrops Tutorial</a>
    <a href="http://www.flickr.com/photos/arcticpuppy/sets/72157622090180990/">Images by tibchris</a>
    </span>
    </div>

    <!-- The JavaScript -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript">
    $(function() {
    /**
    * for each menu element, on mouseenter,
    * we enlarge the image, and show both sdt_active span and
    * sdt_wrap span. If the element has a sub menu (sdt_box),
    * then we slide it - if the element is the last one in the menu
    * we slide it to the left, otherwise to the right
    */
    $('#sdt_menu > li').bind('mouseenter',function(){
    var $elem = $(this);
    $elem.find('img')
    .stop(true)
    .animate({
    'width':'170px',
    'height':'170px',
    'left':'0px'
    },400,'easeOutBack')
    .andSelf()
    .find('.sdt_wrap')
    .stop(true)
    .animate({'top':'140px'},500,'easeOutBack')
    .andSelf()
    .find('.sdt_active')
    .stop(true)
    .animate({'height':'170px'},300,function(){
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length){
    var left = '170px';
    if($elem.parent().children().length == $elem.index()+1)
    left = '-170px';
    $sub_menu.show().animate({'left':left},200);
    }
    });
    }).bind('mouseleave',function(){
    var $elem = $(this);
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length)
    $sub_menu.hide().css('left','0px');

    $elem.find('.sdt_active')
    .stop(true)
    .animate({'height':'0px'},300)
    .andSelf().find('img')
    .stop(true)
    .animate({
    'width':'0px',
    'height':'0px',
    'left':'85px'},400)
    .andSelf()
    .find('.sdt_wrap')
    .stop(true)
    .animate({'top':'25px'},500);
    });
    });
    </script>
    </body>
    </html>


    style.css

    ul.sdt_menu{
    margin:0;
    padding:0;
    list-style: none;
    font-family:"Myriad Pro", "Trebuchet MS", sans-serif;
    font-size:14px;
    width:1020px;
    }
    ul.sdt_menu a{
    text-decoration:none;
    outline:none;
    }
    ul.sdt_menu li{
    float:left;
    width:170px;
    height:85px;
    position:relative;
    cursorointer;
    }
    ul.sdt_menu li > a{
    position:absolute;
    top:0px;
    left:0px;
    width:170px;
    height:85px;
    z-index:12;
    background:transparent url(../images/overlay.png) no-repeat bottom right;
    -moz-box-shadow:0px 0px 2px #000 inset;
    -webkit-box-shadow:0px 0px 2px #000 inset;
    box-shadow:0px 0px 2px #000 inset;
    }
    ul.sdt_menu li a img{
    border:none;
    position:absolute;
    width:0px;
    height:0px;
    bottom:0px;
    left:85px;
    z-index:100;
    -moz-box-shadow:0px 0px 4px #000;
    -webkit-box-shadow:0px 0px 4px #000;
    box-shadow:0px 0px 4px #000;
    }
    ul.sdt_menu li span.sdt_wrap{
    position:absolute;
    top:25px;
    left:0px;
    width:170px;
    height:60px;
    z-index:15;
    }
    ul.sdt_menu li span.sdt_active{
    position:absolute;
    background:#111;
    top:85px;
    width:170px;
    height:0px;
    left:0px;
    z-index:14;
    -moz-box-shadow:0px 0px 4px #000 inset;
    -webkit-box-shadow:0px 0px 4px #000 inset;
    box-shadow:0px 0px 4px #000 inset;
    }
    ul.sdt_menu li span span.sdt_link,
    ul.sdt_menu li span span.sdt_descr,
    ul.sdt_menu li div.sdt_box a{
    margin-left:15px;
    text-transform:uppercase;
    text-shadow:1px 1px 1px #000;
    }
    ul.sdt_menu li span span.sdt_link{
    color:#fff;
    font-size:24px;
    float:left;
    clear:both;
    }
    ul.sdt_menu li span span.sdt_descr{
    color:#0B75AF;
    float:left;
    clear:both;
    width:155px; /*For dumbass IE7*/
    font-size:10px;
    letter-spacing:1px;
    }
    ul.sdt_menu li div.sdt_box{
    display:block;
    position:absolute;
    width:170px;
    overflow:hidden;
    height:170px;
    top:85px;
    left:0px;
    display:none;
    background:#000;
    }
    ul.sdt_menu li div.sdt_box a{
    float:left;
    clear:both;
    line-height:30px;
    color:#0B75AF;
    }
    ul.sdt_menu li div.sdt_box a:first-child{
    margin-top:15px;
    }
    ul.sdt_menu li div.sdt_box a:hover{
    color:#fff;
    }
    there is also a file called jquery.easing.1.3.js but i dont thinkthat one needs editing

  2. #2
    Join Date
    Jul 2013
    Location
    France
    Posts
    18
    hello there,

    open your style.css and look for :

    ul.sdt_menu{
    margin:0;
    padding:0;
    list-style: none;
    font-family:"Myriad Pro", "Trebuchet MS", sans-serif;
    font-size:14px;
    width:1020px;
    }

    Replace it with :

    Code:
    ul.sdt_menu{
    margin: auto;
    list-style: none;
    font-family:"Myriad Pro", "Trebuchet MS", sans-serif;
    font-size:14px;
    width:1020px;
    }
    Goodluck

  3. #3
    Join Date
    Jan 2014
    Posts
    2
    hi deadmix

    thanks a bunch for your answer. found it & works,
    moving on to the next problem

    thanks again,

    R.

  4. #4
    Join Date
    Jul 2013
    Location
    France
    Posts
    18
    You are welcome and good luck

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.15193 seconds
  • Memory Usage 2,895KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (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)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./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
  • ./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 (70):
  • 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
  • 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