13 мая 2008 ~ 5807 Комментариев

Динамичное меню

menu

Давненько я уже не писал рецептов красивых и интересных веб-вкусностей.

Сегодня я опишу способ от Bedrich Rios, по созданию приятного и динамичного меню при помощи JavaScript библиотеки jQuery, которая очень быстро набирает свою популярность.

Возможно использовать jQuery для такого простого эффекта сильно неоправданно, но для тех кто уже использует эту библиотеку — очень пригодиться!

И так, начнем :-)

Создаем «каркас» нашего будущего меню:

<ul id="sliding-navigation">      
<li class="sliding-element"><h3>Пример меню</h3></li>      
<li class="sliding-element"><a href="#">Ссылка 1</a></li>      
<li class="sliding-element"><a href="#">Ссылка 2</a></li>      
<li class="sliding-element"><a href="#">Ссылка 3</a></li>      
<li class="sliding-element"><a href="#">Ссылка 4</a></li>      
<li class="sliding-element"><a href="#">Ссылка 5</a></li>  
</ul>   

Подключаем все необходимые стили и библиотеки вставив следующий код между тегами <head></head>:

<link rel="stylesheet" type="text/css" href="styles.css" />  
<script type="text/javascript" src="jquery.js"></script>  
<script type="text/javascript" src="sliding_effect.js"></script>   

Вот в принципе и все, меню уже готово.

Но для более опытных пользователей я более подробно разберу использование этого эффекта.

Эффект запускается при помощи этой функции:

slide(navigation_id, pad_out, pad_in, time, multiplier)

 

navigation_id — название блока, в котором данный эффект будет использоваться.

pad_out — основной отступ меню в состоянии покоя

pad_in — отступ при наведении на меню

time — время «выпрыгивания» меню при загрузке страницы

multiplier — извините, но так и не понял зачем эта переменная вообще нужна(буду благодарен если подскажите) :-)

Теперь, мне кажется, проблем возникнуть не должно.

Пока. До встречи! ;-)

Посмотреть пример использования

Скачать пример

Прочитать на первоисточнике(Английский)

5807 Комментариев для “Динамичное меню”

  1. Артём Курапов 13 мая 2008 at 17:52 Permalink

    Давно ищу дерево для админки с возможностью перетаскивания элементов и сериализации на jQuery. Увы и это не то.

  2. Я собственной персоной 13 мая 2008 at 18:04 Permalink

    Давно ищу дерево для админки с возможностью перетаскивания элементов и сериализации на jQuery. Увы и это не то.

    Если найду что-то подобное — обязательно напишу об этом в блоге! ;-)

  3. serf 13 мая 2008 at 18:20 Permalink

    В демках мутулсы такое же меню

  4. Krov 13 мая 2008 at 21:25 Permalink

    Давно ищу дерево для админки с возможностью перетаскивания элементов и сериализации на jQuery. Увы и это не то.

    Возможно вам подойдёт вот это – http://www.linkexchanger.su/2008/23.html

  5. Александр 14 мая 2008 at 1:28 Permalink

    multiplier — извините, но так и не понял зачем эта переменная вообще нужна(буду благодарен если подскажите) :-)

    конечно могу только догадываться конечно, но скорее всего это количество шагов (промежуточных состояний) при выпрыгивании. То есть допустим время выпрыгивания 1сек и если multiplier =5 то состояние меняется каждые 0.2 сек, а если 10 то каждую 0.1. То есть как бы количество кадров.

  6. Александр 14 мая 2008 at 1:29 Permalink

    жуть сколько у меня в комменте слов-паразитов. =)

  7. Серега 14 мая 2008 at 20:50 Permalink

    Круто! Интересная менюшка. Спасибо!

  8. Vadyacorp 15 мая 2008 at 9:14 Permalink

    Все же я за mootools, с тех пор, как jQuery не смог выдать мне $(‘#form’).css(‘border’), в то время как mootools $(‘form’).getStyle(‘border’) выдал мне честные ’1px solid #000000′

    http://mootools.net/ – собственно, вот оно на мутулзе сделано :)

  9. r00ger 18 июня 2008 at 20:53 Permalink

    timer = (timer*multiplier + time);
    $(this).animate({ marginLeft: «0″ }, timer);
    Отсюда понятно, что параметр multiplier это скорость анимации.

  10. MakKlays 25 декабря 2008 at 23:00 Permalink

    Вот прочитал все написанное, а сам перед этим кое-что «отрыл», но в jQuery не очень, qoogl-ю лучше :) http://news.kg/wp-content/uploads/tree/index_ru.html – хорошое красивое и очень практичное дерево…

    Вопрос!? Кто знает, как его перестроить так чтобы в id-шники шли не попорядку (от 0 до n), а с применением парентов… Ой!.. То есть, так, чтобы можно было подключить БД для построения… Кстати, а как это сделать (где втиснуться в коде, в какой функции ?)…

    Спасибо, очень нужно.
    Удачи!

  11. Spens 9 апреля 2009 at 18:39 Permalink

    Люди помогите
    очень долго делаю сайты и на пхп с мускулом и с перлом знаком – и очень редко вообще использовал подобные штуковины
    но тут вдруг понадобилось – зашел сюда нашёл что нада вообщем всё круто красиво и т.д.
    накачал кучу и сталкнулся с проблеммой с которой никогда дела не имел и даже понятия не имею как к ней подступиться даже
    вообщем проблемма в том что когда себе ставлю скрипты вдруг браузер запрашивает разрешение на использование activex
    а у вас в примерах не запрашивал
    очень интерестно стало как вы это обошли
    заранее спасибо – очень жду ответа

  12. Spens 9 апреля 2009 at 19:49 Permalink

    Люди помогите
    очень долго делаю сайты и на пхп с мускулом и с перлом знаком – и очень редко вообще использовал подобные штуковины
    но тут вдруг понадобилось – зашел сюда нашёл что нада вообщем всё круто красиво и т.д.
    накачал кучу и сталкнулся с проблеммой с которой никогда дела не имел и даже понятия не имею как к ней подступиться даже
    вообщем проблемма в том что когда себе ставлю скрипты вдруг браузер запрашивает разрешение на использование activex
    а у вас в примерах не запрашивал
    очень интерестно стало как вы это обошли
    заранее спасибо – очень жду ответа

    а всё =) проблемма отпала так-же как появилась – после того как на хост залил всё работает на ура =)

  13. mosre 18 ноября 2009 at 9:05 Permalink

    Можно поэтапно?! Куда что писать и вставлять..
    С такой менюшкой на скриптах сталкиваюсь впервые
    и досих пор не могу разобраться.. Помогите уж,
    пожалуйста..

  14. lazuren 18 апреля 2011 at 21:20 Permalink

    Коллеги у меня такая проблема! Когда вставляю вот эти строки

    Во первых стиль меню задается всей странице, а во вторых перестают работать другие элементы на javascript!

    Подскажите как сделать так чтобы этот javascript и стили действовали только на меню!

  15. lazuren 18 апреля 2011 at 21:22 Permalink

    Коллеги у меня такая проблема! Когда вставляю строки
    подключения скрипта!

    Во первых стиль меню, задается всей странице, а во вторых перестают работать другие элементы на javascript!

    Подскажите как сделать так чтобы этот javascript и стили действовали только на меню?

  16. LambertMarisol35 15 сентября 2011 at 0:05 Permalink

    Have no enough cash to buy a building? Don’t worry, just because it is available to take the business loans to resolve such problems. Hence take a sba loan to buy everything you want.

  17. webzver 7 ноября 2011 at 1:31 Permalink

    Менюшка просто суппер пуппер!
    Но у меня вышла проблема… менюшка очень понравилась, хочень хотел бы была она на сайте, но нужно двухуровневое!
    Кто может помочь ребята!

  18. Kia Hrabal 24 февраля 2012 at 17:06 Permalink

    Spot on with this write-up, I truly suppose this web site wants rather more consideration. I’ll in all probability be once more to read far more, thanks for that info.

  19. Yessenia Delsavio 25 февраля 2012 at 19:15 Permalink

    Fastidious answers in return of this question with genuine arguments and explaining the whole thing concerning that.

  20. Maggie Marinez 26 февраля 2012 at 2:34 Permalink

    Your house is valueble for me. Thanks!…

  21. Douglass Stanback 26 февраля 2012 at 10:24 Permalink

    I just want to mention I’m very new to blogging and absolutely enjoyed your blog. Likely I’m planning to bookmark your blog post . You actually have incredible stories. Thanks a bunch for sharing with us your blog site.

  22. Leon America 26 февраля 2012 at 13:51 Permalink

    I precisely wished to thank you so much once again. I’m not certain the things that I could possibly have followed in the absence of these opinions provided by you regarding such a question. It was before a horrifying scenario for me personally, however , viewing the specialised strategy you managed the issue took me to cry over happiness. I’m just happy for your help and even wish you know what a powerful job your are getting into educating many others using your blog. I know that you’ve never got to know all of us.

  23. May 29 февраля 2012 at 7:06 Permalink

    WONDERFUL Post.thanks for share..more wait ..

  24. Marx 29 февраля 2012 at 7:08 Permalink

    Forgot to ask this, who did the art for the homepage? That drawing style seems familiar.

  25. Letisha 29 февраля 2012 at 7:34 Permalink

    Just the article I was hoping to see! Thanks! I discovered your blog site site online and check a number of your early on posts. Keep up the really good operate. I recently additional increase RSS feed to help my Yahoo News Viewer. Seeking forward to reading extra from you down the line!…

  26. Lilliana 29 февраля 2012 at 7:46 Permalink

    Hello there, I found your website via Google while searching for a related topic, your site came up, it looks great. I have bookmarked it in my google bookmarks.

  27. Lavelle 29 февраля 2012 at 7:56 Permalink

    An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  28. Perez 29 февраля 2012 at 7:57 Permalink

    I’ve been absent for some time, but now I remember why I used to love this website. Thanks, I’ll try and check back more frequently. How frequently you update your web site?

  29. Marline 29 февраля 2012 at 8:30 Permalink

    Thanks for another informative site. Where else could I get that kind of information written in such an ideal way? I’ve a project that I am just now working on, and I’ve been on the look out for such information.

  30. Merrie 29 февраля 2012 at 8:33 Permalink

    Aw, this has been a really nice post. In plan I would like to put in writing similar to this additionally * taking time plus actual work to make a very good article… but exactly what do I say… My spouse and i procrastinate a large amount and by virtually no means apparently get something perfo

  31. Reiko 29 февраля 2012 at 9:18 Permalink

    An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  32. maleextra reviews 29 февраля 2012 at 11:41 Permalink

    brand-new pertaining to 2012 Male Extra Reviews

  33. Jimenez 29 февраля 2012 at 12:14 Permalink

    Reading this blog always makes me feel like not only have I gotten my daily dose of pretty, but that I’m not the only one who ponders the groceries vs shoes fashion thing.

  34. Where to Buy MaleExtra 29 февраля 2012 at 12:23 Permalink

    Male Extra Is a totally natural solution for Male Enhancement

  35. Suzy Varty 29 февраля 2012 at 15:21 Permalink

    Best slim weight patch,,Best slimweight patch,professional review of the slim weight patch ,2012 slimweight patch review ,slim weight patchhottestreview,

  36. buy scrapebox list 29 февраля 2012 at 17:33 Permalink

    This write-up gives the light in which we can observe the reality. This is really good one and gives in-depth details. Thanks for this good write-up.

  37. barbecue electrique 29 февраля 2012 at 18:14 Permalink

    Hey There. I found your blog using msn. This is an extremely neatly written article. I’ll make sure to bookmark it and come back to learn more of your useful info. Thanks for the post. I will definitely return.

  38. Get free WSO 29 февраля 2012 at 18:36 Permalink

    Quite fascinating details!Perfect just what I was seeking for!

  39. Get free WSO 29 февраля 2012 at 18:36 Permalink

    Awesome write-up , I’m going to spend much more time researching this topic

  40. http://www.veloenfant.org/ 29 февраля 2012 at 19:54 Permalink

    I believe this internet site contains very good indited written content blog posts.

  41. ceramic watches 29 февраля 2012 at 20:25 Permalink

    I like this website very much, Its a really nice situation to read and incur information. «Anyone can stop a man’s life, but no one his death a thousand doors open on to it. – Phoenissae» by Lucius Annaeus Seneca.

  42. montre gps 29 февраля 2012 at 20:43 Permalink

    Enjoyed examining this, very good stuff, thanks .

  43. camescope hd 29 февраля 2012 at 21:11 Permalink

    I’d perpetually want to be update on new posts on this site, bookmarked ! .

  44. chaussure de foot puma 29 февраля 2012 at 22:42 Permalink

    magnificent issues altogether, you just won a logo new reader. What would you suggest in regards to your publish that you just made a few days ago? Any positive?

  45. disque dur ssd 29 февраля 2012 at 23:09 Permalink

    I don’t usually comment but I gotta admit thankyou for the post on this perfect one : D.

  46. dog training 1 марта 2012 at 0:33 Permalink

    Doo y0u mind 1f I quoote a couple of your posts as long as I provide credit and sources back to your weblog? My blog is in the very same niche as yours and my visitors would really benefit from some of the information you provide here. Please let me know if this okay with you. Regards

  47. South Carolina farm bureau mutual 1 марта 2012 at 1:44 Permalink

    Helpful information. Lucky me I discovered your website accidentally, and I’m stunned why this accident did not happened in advance! I bookmarked it.

  48. compensation consulting firm 1 марта 2012 at 1:54 Permalink

    Wow! This can be one particular of the most helpful blogs We have ever arrive across on this subject. Actually Wonderful. I am also an expert in this topic so I can understand your effort.

  49. Denisse 1 марта 2012 at 2:06 Permalink

    A unique discussion might be priced at comment. I believe that you should produce more on this specific topic, may well be a taboo topic but frequently people are too few to speak for such topics. To the next. Best wishes

  50. Teisha 1 марта 2012 at 2:16 Permalink

    Hello there, I found your website via Google while searching for a related topic, your site came up, it looks great. I have bookmarked it in my google bookmarks.


Оставить комментарий