Being in the mood for experimenting with CSS3, I'd like to show you some creative menu hover effects in today's tutorial. The idea is to have a simple composition of elements, an icon, a main title and a secondary title, that will be animated on hover using only CSS transitions and animations. We'll be exploring some different effects for the elements.
There are so many great things we can do with the additional properties and possibilities that CSS3 brings along. Today I want to show you how to experiment with text shadows and with transitions in order to achieve a blur effect that we'll apply to a menu on hovering over the elements. The main idea is to blur the other items while enhancing the one we are currently hovering.
Ultimos Comentarios
yennit dijo:
gracias por los codigos, nos ha ayudado demasiado... :D
Eduard dijo:
Buenos dias este tipo de menu lo encuentro muy adecuado para una web que me gustaria desarrollar, seria posible hacer ...
gio dijo:
ya lo adapte ami sitio pero no puedo agregar imagenes podrian ayudarme para ver que hay que cambiar y que parametros modificar ...
alex dijo:
la pagina no se encuantra vigente.
Nestor dijo:
¿es personalizable en el sentido de mostrar mas de 4 imagenes en fila?
lks dijo:
Las aplicaciones son gratuitas, cualquier duda consulta la pagina del autor
drbafle dijo:
Como puedo modificar este script para que no me cargue las fotos desde picasa? he estado mirando la parte de la URL de picasa, ...
Create a Fast and Simple Toggle View Content with jQuery![]()
![]()
Introduction
This would be a simple, quick and easy tutorial. The reason I make this tutorial is for my upcoming post which will show you the plugins and scripts that I used in my most recent project. It's going to be a really useful post and make sure you won't miss it :)
This script is fairly straight forward. What it does is using the UL list and allow user to toggle to display the content of LI items. This is a really useful user interface feature that it helps designers to save space and build a less complicated user interface. It eliminates redundant element and allow user view the content only when they want to see it.
And...... this is how it will look like:
1. HTML
It consists of UL list and the rest is quite self-explanatory.
<ul id="toggle-view"> <li> <h3>Title 1</h3> <span>+</span> <div class="panel"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim.</p> </div> </li> <li> <h3>Title 2</h3> <span>+</span> <div class="panel"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim.</p> </div> </li> <li> <h3>Title 3</h3> <span>+</span> <div class="panel"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim.</p> </div> </li> </ul>2. CSS
I used the minimum CSS code to style this tutorial. The most important thing is, we have to make sure the P is hidden by default.
#toggle-view { list-style:none; font-family:arial; font-size:11px; margin:0; padding:0; width:300px; } #toggle-view li { margin:10px; border-bottom:1px solid #ccc; position:relative; cursor:pointer; } #toggle-view h3 { margin:0; font-size:14px; } #toggle-view span { position:absolute; right:5px; top:0; color:#ccc; font-size:13px; } #toggle-view .panel { margin:5px 0; display:none; }3. Javascript
This would be one of my shortest jQuery code! We attach click event to the LI item and everytime a user click on the item check if P tag is visible. If it's hidden, show it otherwise hide it. Also, it will change the html value for the SPAN to either plus or negative sign.
$(document).ready(function () { $('#toggle-view li').click(function () { var text = $(this).children('div.panel'); if (text.is(':hidden')) { text.slideDown('200'); $(this).children('span').html('-'); } else { text.slideUp('200'); $(this).children('span').html('+'); } }); });Conclusion
I hope you will like this quick and short tutorial! :) stay tuned for my upcoming post!
![]()
![]()
AdvertisementIncredible online 640-816 dumps training programs & BCP-420 help you in pass 640-553 exam regarding 642-617. We offer best quality 650-987 training tools for your success.
Show Some Love, Spread This Post!
Ultimos Comentarios
yennit dijo:
gracias por los codigos, nos ha ayudado demasiado... :D
Eduard dijo:
Buenos dias este tipo de menu lo encuentro muy adecuado para una web que me gustaria desarrollar, seria posible hacer ...
gio dijo:
ya lo adapte ami sitio pero no puedo agregar imagenes podrian ayudarme para ver que hay que cambiar y que parametros modificar ...
alex dijo:
la pagina no se encuantra vigente.
Nestor dijo:
¿es personalizable en el sentido de mostrar mas de 4 imagenes en fila?
lks dijo:
Las aplicaciones son gratuitas, cualquier duda consulta la pagina del autor
drbafle dijo:
Como puedo modificar este script para que no me cargue las fotos desde picasa? he estado mirando la parte de la URL de picasa, ...
Galeria y recurss
Description
Free CSS Drop-Down Menu Framework was first released back in June, 2008. Since then it has struck the audiences with its perfect cross browser performance and wide variety of drop-down menu transformations and themes. As the internet changes this project remains a steady advocate of purely CSS driven solutions.
- Modular, with themes. Not only HTML is separated from CSS, but even CSS definitions are categorized into structural and thematic types. Thus creating a new css drop-down menu means creating only a new theme since structure is permanent. What is more, creating a new theme is easy when you have the best hosting plan for your site.
- Easily deployable. The code and files are well organized. Available channels to hook up to your CMS or other tools as well as existing websites in XHTML or HTML5 format.
- Easily transformable. Can be transformed by changing class name only. Available transformations: horizontal, vertical left-to-right, vertical right-to-left, horizontal linear, horizontal upwards.
- Cross browser. Configurations available for Windows Internet Explorer 7 or later, Mozilla Firefox 1.5 or later, Opera 7 or later, Apple Safari 2 or later, Google Chrome, etc.
- Super Fast. Having the above mentioned features it is not affected by any disturbances whatsoever.
- Continuous development. The project is constantly revised and improved.
- No JavaScript whatsoever!
Se filtran las imágenes dependiendo del menu
Creating a “Filterable” Portfolio, una atractiva practica basada en jQuery para filtrar categorías. Posee un efecto simple pero llamativo y fue desarrollada pensando en la creación de porfolios personales. Suponiendo que tengamos 5 categorías principales: Diseño, Desarrollo, Webs, CMS, logos, Grafica. Una vez que se hace clic sobre una de las categorías del menú de navegación, solo se mostraran las imágenes que formen parte de esa sección, el resto desaparecerá y permanecerá oculto. Otra forma muy interesante para hacer aun más atractivo nuestros porfolios.
Ver demo - Mas Info y Descarga Creating a “Filterable” PortfolioJavaScript:$(document).ready(function() {
$('ul#filter a').click(function() {
$(this).css('outline','none');
$('ul#filter .current').removeClass('current');
$(this).parent().addClass('current');
var filterVal = $(this).text().toLowerCase().replace(' ','-');
if(filterVal == 'all') {
$('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden');
} else {
$('ul#portfolio li').each(function() {
if(!$(this).hasClass(filterVal)) {
$(this).fadeOut('normal').addClass('hidden');
} else {
$(this).fadeIn('slow').removeClass('hidden');
}
});
}
return false;
});
});
Al dar clic cambia la cabeza
Una de las tendencias en el diseño web es el uso dinámico de imágenes o la implementación de Banners rotativos utilizando efectos denominados “slideshow”. Existen diversas formas de lograr estos efectos, y una de ellas, Tabbed Content Rotator, una bonita practica basada en jQuery que nos permitirá integrar imágenes, texto y navegación, en una serie de pestañas rotativas. Una idea muy interesante para presentar productos y servicios.
Ver Demo – Mas Info Tabbed Content Rotator – Descarga
Al dar cloc se expande
Animated Drop Down Menu with jQuery, un bonito menú desplegable basado en jQuery y Css. Muy práctico para ubicarlo en la sección superior de nuestro header, ya que ocupa muy poco lugar y a su vez lograra llamar la atención de los usuarios. Me recuerda mucho al menú de NETTUTS como a todos los de la red de Envato.
Uso
Realizar las llamadas correspondientes desde nuestro encabezado < head>JavaScript:<script type="text/javascript" src="jsfiles/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("ul.menu_body li:even").addClass("alt");
$('img.menu_head').click(function () {
$('ul.menu_body').slideToggle('medium');
});
$('ul.menu_body li a').mouseover(function () {
$(this).animate({ fontSize: "14px", paddingLeft: "20px" }, 50 );
});
$('ul.menu_body li a').mouseout(function () {
$(this).animate({ fontSize: "12px", paddingLeft: "10px" }, 50 );
});
});
</script>agregar estilo
CSS:ul, li{margin:0; padding:0; list-style:none;}
.menu_head{border:1px solid #998675;}.menu_body {display:none; width:184px;border-right:1px solid #998675;border-bottom:1px solid #998675;border-left:1px solid #998675;}
.menu_body li{background:#493e3b;}
.menu_body li.alt{background:#362f2d;}
.menu_body li a{color:#FFFFFF; text-decoration:none; padding:10px; display:block;}
.menu_body li a:hover{padding:15px 10px; font-weight:bold;}nuestro Menu
HTML:<img src="images/navigate.png" width="184" height="32" class="menu_head" />
<ul class="menu_body">
<li><a href="#">About Us</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Support Forums</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Contact Us</a></li>
</ul>Mas Info Animated Drop Down Menu with jQuery,
Menú que cambia el fondo
Last updated on May 31, 2012 Originally published on July 24, 2010 by malihu, under Plugins, Templates & web apps.
Animated page scrolling to specific id within the document with jquery. Article contains a jquery plugin you can use for simple “back to top” links or complex single-page websites menus, as well as a single-page CSS template with additional features.
Page scroll to id plugin
Download the archive which contains the plugin files, as well as examples and a single-page css template. Extract files and upload jquery.malihu.PageScroll2id.js to your web server.
Include jquery, jquery UI and jquery.malihu.PageScroll2id.js in your html document
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script src="jquery.malihu.PageScroll2id.js"></script>The code above can be inserted inside the head tag or at the very bottom of your document, before the closing body tag (which is normally recommended for better performance). We’re using Google’s CDN to get jquery and jquery UI libraries (why?).
What these files do
jquery is the javascript library used by the Page scroll to id plugin (I’m making the crazy assumption here that you do know what jquery is. In case you don’t, here it is).
jquery UI (jQuery User Interface) extends jquery library and provides animation easing (you can make your own custom jquery UI bundle if you wanna cut down the size, see http://jqueryui.com/download).
jquery.malihu.PageScroll2id.js is our plugin file
Call mPageScroll2id function on window load (after the inclusion of the plugin files), either in the head or body tag
<script> (function($){ $(window).load(function(){ $("a[rel='m_PageScroll2id']").mPageScroll2id(); }); })(jQuery); </script>Note that we’re wrapping our jquery code with (function($){ ... })(jQuery);. This ensures no conflict between jquery and other libraries using $ shortcut. See Using jQuery with Other Libraries for more info. We also use window load ($(window).load()) so the code executes after all page elements are fully loaded.
The a[rel='m_PageScroll2id'] selector used here means that the plugin will apply to any anchor element with m_PageScroll2id rel attribute value (e.g. <a href="#targetID" rel="m_PageScroll2id">link</a>).
When we click <a href="#targetID" rel="m_PageScroll2id">link</a>, the page will scroll to the element with id="targetID" within the document. So all that’s left to do, is create your unique id sections (e.g. <div id="myID">Section</div>) and the links that point to these sections within your page (e.g. <a href="#myID" rel="m_PageScroll2id">Go to section</a>).
You can change the function call selector to anything you want (an id, class name etc.). For instance, if you want the script to apply to all links with class name “myClass”, you simply do:
$("a.myClass").mPageScroll2id();You can also have multiple selectors by inserting comma separated values. For example the following applies to a)every anchor element that’s inside a container with an id of navigationMenu, b)every link with href attribute value #top and c)every link with rel attribute value m_PageScroll2id
$("#navigationMenu a,a[href='#top'],a[rel='m_PageScroll2id']").mPageScroll2id();That’s all you need to use the plugin. The code below is a most basic html example of a single-page using it:
<!DOCTYPE HTML> <html> <head> <style> #section_1,#section_2,#section_3{ height:1000px; } </style> </head> <body id="top"> <ul class="navigation-menu"> <li> <a href="#section_1" rel="m_PageScroll2id">section 1</a> </li> <li> <a href="#section_2" rel="m_PageScroll2id">section 2</a> </li> <li> <a href="#section_3" rel="m_PageScroll2id">section 3</a> </li> </ul> <div id="section_1"> Section 1 content </div> <div id="section_2"> Section 2 content </div> <div id="section_3"> Section 3 content </div> <a href="#top" rel="m_PageScroll2id">Back to top</a> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script src="jquery.malihu.PageScroll2id.js"></script> <script> (function($){ $(window).load(function(){ $("a[rel='m_PageScroll2id']").mPageScroll2id(); }); })(jQuery); </script> </body> </html>Configuration
mPageScroll2id function can get the following option parameters in order to customize its behavior and basic functionality:
scrollSpeed: IntegerScroll animation speed, value in milliseconds autoScrollSpeed: BooleanAuto-adjust animation speed according to element position, values: true, false scrollEasing: StringScroll animation easing type when page is idle, see jquery UI easing for all available easing types scrollingEasing: StringScroll animation easing type when page is animated, see jquery UI easing for all available easing types callback: function(){}User custom callback function to run after a scrolling animation is completed. Example: callback:function(){ alert("callback"); } pageEndSmoothScroll: BooleanEnd of page smooth scrolling (if bottom elements are too short), values: true, false layout: StringPage layout defines scrolling direction, values: vertical, horizontal, auto
Settinglayout: "auto"scrolls page both horizontally an vertically. See the demoAn example of defining these options parameters and their default values is as follows
$("a[rel='m_PageScroll2id']").mPageScroll2id({ scrollSpeed:1300, autoScrollSpeed:true, scrollEasing:"easeInOutExpo", scrollingEasing:"easeInOutCirc", callback:function(){}, pageEndSmoothScroll:true, layout:"vertical" });Deep linking
There are many solutions for deep linking. The code below is an example of Page scroll to id plugin combined with Asual’s jquery address plugin:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script src="jquery.malihu.PageScroll2id.js"></script> <!-- include jquery address plugin --> <script src="jquery.address-1.4.min.js"></script> <script> (function($){ $(window).load(function(){ /* call both mPageScroll2id and address functions on our selector */ $("a[rel='m_PageScroll2id']").mPageScroll2id().address(); /* call "externalChange" method of jquery address plugin to scroll page on browser back/forward */ $.address.externalChange(function(event){ if(event.value){ var eVal=event.value.replace("/",""); if(eVal===""){ eVal="top"; } /* call "history" method of mPageScroll2id and pass jquery address hash value */ $().mPageScroll2id("history",{ scrollTo:eVal }); } }); }); })(jQuery); </script>By calling the “externalChange” method of jquery address plugin and passing its returned value via Page scroll to id “history” method, the page will scroll to the corresponding id each time we hit browser’s back/forward buttons or change the url in the address bar. Deep linking demo
- May 31, 2012
- Developed jquery plugin out of the original Animate page to id script
Created single-page CSS templateLicense
You are free to use, study, improve and modify this script wherever and however you like.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
Wordpress plugins are licensed under GNU General Public License.Donating helps greatly in developing and updating free software and running this blog :)
Menú que cambia el fondo
Horizontal page animation with easing using jquery. A very simple and basic tutorial on how to animate content horizontaly using just a few lines of javascript.
Start by loading the jquery library by inserting the following between the head tag of your document
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>This code loads the jquery library straight from Google and we do this for caching speed.
We also need to insert another jquery plugin that does the easing part:
<script src="jquery.easing.1.3.js" type="text/javascript"></script>Next we need to create the actual function that does the trick of animating our document. We’ll insert this script at the very end of our markup, just before the closing body tag:
<script> function Animate2id(id,ease){ //the id to animate, the easing type var animSpeed=2000; //set animation speed var $container=$("#container"); //define the container to move if(ease){ //check if ease variable is set var easeType=ease; } else { var easeType="easeOutQuart"; //set default easing type } //do the animation $container.stop().animate({"left": -($(id).position().left)}, animSpeed, easeType); } </script>This function gets the target id (id), easing type (ease) and animates the container with a nice easing effect. Inside the function we can set the animation speed (var animSpeed), the default easing type and the container to animate (var $container).
In order to use the function we can call it from a text link like this:
<a href="#" onclick="Animate2id('#c1','easeInOutExpo'); return false">Content 1</a>Inside the function call we set the id to animate to (‘#c1′) and the easing type (‘easeInOutExpo’). If we don’t set an easing type, the default one will be used which is defined inside the main function. We use return false in order to prevent the default browser action when clicking an anchor.
The css (inside head tag or link):
html,body{margin:0px; padding:0px; height:100%;} body{overflow:hidden; position:relative;} #menu{position:fixed; z-index: 2; top:10px; left:10px; clear:both; border:1px solid #666; padding:5px; background:#fff;} #menu a{margin-left:5px; margin-right:5px;} #container{position:relative; left:0; width:10000px; top:0; height:100%;} #c1,#c2,#c3,#c4,#c5,#c6 {width:1500px; height:100%; float:left; margin-right:100px;} #c1,#c3,#c5 {background:#eee;} #c2,#c4,#c6 {background:#fff;} .content{padding:60px 20px;}And finally our html code:
<div id="menu"> <a href="#" onclick="Animate2id('#c1'); return false" title="Go to 1st content with the default easing">Content 1</a> <a href="#" onclick="Animate2id('#c2','easeInOutExpo'); return false" title="Go to 2nd content. Easing type: easeInOutExpo">Content 2</a> <a href="#" onclick="Animate2id('#c3','easeOutQuint'); return false" title="Go to 3rd content. Easing type: easeOutQuint">Content 3</a> <a href="#" onclick="Animate2id('#c4','easeOutElastic'); return false" title="Go to 4th content. Easing type: easeOutElastic">Content 4</a> <a href="#" onclick="Animate2id('#c5','easeOutBack'); return false" title="Go to 5th content. Easing type: easeOutBack">Content 5</a> <a href="#" onclick="Animate2id('#c6','easeOutBounce'); return false" title="Go to 6th content. Easing type: easeOutBounce">Content 6</a> </div> <div id="container"> <div id="c1"> <div class="content">Content 1</div> </div> <div id="c2"> <div class="content">Content 2</div> </div> <div id="c3"> <div class="content">Content 3</div> </div> <div id="c4"> <div class="content">Content 4</div> </div> <div id="c5"> <div class="content">Content 5</div> </div> <div id="c6"> <div class="content">Content 5</div> </div> </div>That’s about it
License
You are free to use, study, improve and modify this script wherever and however you like.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
Wordpress plugins are licensed under GNU General Public License.Donating helps greatly in developing and updating free software and running this blog :)
Excelente menú desplegable y que sigue el movimiento del scrol
A simple navigation menu that “follows” page scrolling and expands on mouse over, made with css and jquery.
The code
The css
body{margin:0px; padding:0px;} #fl_menu{position:absolute; top:50px; left:0px; z-index:9999; width:150px; height:50px;} #fl_menu .label{padding-left:20px; line-height:50px; font-family:"Arial Black", Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; background:#000; color:#fff; letter-spacing:7px;} #fl_menu .menu{display:none;} #fl_menu .menu .menu_item{display:block; background:#000; color:#bbb; border-top:1px solid #333; padding:10px 20px; font-family:Arial, Helvetica, sans-serif; font-size:12px; text-decoration:none;} #fl_menu .menu a.menu_item:hover{background:#333; color:#fff;}The jQuery library and plugins inside head tag
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script> <script src="jquery.easing.1.3.js" type="text/javascript"></script>The floating menu markup
<div id="fl_menu"> <div class="label">MENU</div> <div class="menu"> <a href="#" class="menu_item">An menu item</a> <a href="#" class="menu_item">A long menu item</a> <a href="#" class="menu_item">Item 3</a> <a href="#" class="menu_item">Another one</a> <a href="#" class="menu_item">A really, really long menu item</a> <a href="#" class="menu_item">Menu item 6</a> <a href="#" class="menu_item">And one more</a> <a href="#" class="menu_item">A tiny</a> </div> </div>The floating menu script is inserted in the end of the document, right before the closing body tag
<script> //config $float_speed=1500; //milliseconds $float_easing="easeOutQuint"; $menu_fade_speed=500; //milliseconds $closed_menu_opacity=0.75; //cache vars $fl_menu=$("#fl_menu"); $fl_menu_menu=$("#fl_menu .menu"); $fl_menu_label=$("#fl_menu .label"); $(window).load(function() { menuPosition=$('#fl_menu').position().top; FloatMenu(); $fl_menu.hover( function(){ //mouse over $fl_menu_label.fadeTo($menu_fade_speed, 1); $fl_menu_menu.fadeIn($menu_fade_speed); }, function(){ //mouse out $fl_menu_label.fadeTo($menu_fade_speed, $closed_menu_opacity); $fl_menu_menu.fadeOut($menu_fade_speed); } ); }); $(window).scroll(function () { FloatMenu(); }); function FloatMenu(){ var scrollAmount=$(document).scrollTop(); var newPosition=menuPosition+scrollAmount; if($(window).height()<$fl_menu.height()+$fl_menu_menu.height()){ $fl_menu.css("top",menuPosition); } else { $fl_menu.stop().animate({top: newPosition}, $float_speed, $float_easing); } } </script>Under //config comment you can set some configuration options for the menu.
Enjoy
License
You are free to use, study, improve and modify this script wherever and however you like.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
Wordpress plugins are licensed under GNU General Public License.Donating helps greatly in developing and updating free software and running this blog :)
Barras de desplazamiento
Adjustable scroller height with 1/3 range and greater easing, without mouse-wheel support
Aliquam erat volutpat. Maecenas non tortor nulla, non malesuada velit. Nullam felis tellus, tristique nec egestas in, luctus sed diam. Suspendisse potenti.
consectetur adipiscing elit. Nulla consectetur libero consectetur quam consequat nec tincidunt massa feugiat. Donec egestas mi turpis. Fusce adipiscing dui eu metus gravida vel facilisis ligula iaculis. Cras a rhoncus massa. Donec sed purus eget nunc placerat consequat. Nulla facilisi. Nam vel augue odio, dignissim mattis dolor. Nullam at mi aliquet quam interdum consectetur. Duis tempus mauris in lorem dictum eget euismod urna aliquet. In vestibulum tempor porta.
Morbi porttitor rhoncus nisi, eget vehicula quam sodales at. Maecenas ipsum tellus, mollis quis faucibus id, feugiat molestie lacus. Sed nec quam purus, at condimentum quam. Integer imperdiet faucibus urna tempus consectetur. Nullam non purus ligula, et tincidunt nulla. Aenean tincidunt, dui at elementum egestas, sem turpis volutpat turpis, nec congue purus quam quis ligula. Nam dictum rutrum pulvinar. Aenean sed cursus purus. Curabitur non dui eu nibh fermentum interdum a id dui. Fusce iaculis blandit tellus, nec tincidunt massa adipiscing id. Aliquam dui massa, porttitor eget molestie at, semper eu libero. Suspendisse sit amet velit et elit viverra convallis vitae ut turpis. Maecenas vehicula blandit odio sollicitudin eleifend. Curabitur molestie porta neque ac imperdiet. Phasellus nec nisl non lectus pharetra porttitor sit amet tristique mi. Integer vehicula vestibulum sem vitae varius. Ut scelerisque semper posuere.
Aliquam erat volutpat. Maecenas non tortor nulla, non malesuada velit. Nullam felis tellus, tristique nec egestas in, luctus sed diam. Suspendisse potenti. Cras venenatis condimentum nibh a mollis. Duis id sapien nibh. Vivamus porttitor, felis quis blandit tincidunt, erat magna scelerisque urna, a faucibus erat nisl eget nisl. Aliquam consequat turpis id velit egestas a posuere orci semper. Mauris suscipit erat quis urna adipiscing ultricies. In hac habitasse platea dictumst. Nulla scelerisque lorem quis dui sagittis egestas. Etiam sed massa felis, aliquam pellentesque est. Quisque quis ante tortor, sed egestas risus. Maecenas varius adipiscing nulla, nec rhoncus est mattis id. Aenean blandit convallis nisi at fringilla. Nunc id massa eu sapien fringilla posuere.
Nam eu arcu at purus tincidunt pharetra ultrices at ipsum. Mauris urna nunc, vulputate quis gravida in, pharetra id mauris. Ut sit amet mi dictum nulla lobortis adipiscing quis a nulla. Etiam diam ante, imperdiet vel scelerisque eget, venenatis non eros. Praesent ipsum sem, eleifend ut gravida eget, tristique id orci. Nam adipiscing, sem in mattis vulputate, risus libero adipiscing risus, eu molestie mi justo eget nulla. Cras venenatis metus et urna egestas non laoreet orci rutrum. Pellentesque ullamcorper dictum nisl a tincidunt. Quisque et lacus quam, sed hendrerit mi. Mauris pretium, sapien et malesuada pulvinar, lorem leo viverra leo, et egestas mi nisl quis odio. Aliquam erat volutpat. Sed urna arcu, tempus eu vulputate adipiscing, consectetur et orci. Vivamus congue, nunc vitae fringilla convallis, libero massa lacinia lorem, id convallis mauris elit ut leo. Nulla vel odio sem. Duis lorem urna, congue vitae rutrum sed, tincidunt vel tortor. In hac habitasse platea dictumst. Nunc vitae enim ante, vitae facilisis massa. Etiam sagittis sapien at nibh fermentum consectetur convallis lacus blandit.
Aliquam erat volutpat. Maecenas non tortor nulla, non malesuada velit. Nullam felis tellus, tristique nec egestas in, luctus sed diam. Suspendisse potenti. Cras venenatis condimentum nibh a mollis. Duis id sapien nibh. Vivamus porttitor, felis quis blandit tincidunt, erat magna scelerisque urna, a faucibus erat nisl eget nisl. Aliquam consequat turpis id velit egestas a posuere orci semper. Mauris suscipit erat quis urna adipiscing ultricies. In hac habitasse platea dictumst. Nulla scelerisque lorem quis dui sagittis egestas. Etiam sed massa felis, aliquam pellentesque est. Quisque quis ante tortor, sed egestas risus. Maecenas varius adipiscing nulla, nec rhoncus est mattis id. Aenean blandit convallis nisi at fringilla. Nunc id massa eu sapien fringilla posuere.
Nam eu arcu at purus tincidunt pharetra ultrices at ipsum. Mauris urna nunc, vulputate quis gravida in, pharetra id mauris. Ut sit amet mi dictum nulla lobortis adipiscing quis a nulla. Etiam diam ante, imperdiet vel scelerisque eget, venenatis non eros. Praesent ipsum sem, eleifend ut gravida eget, tristique id orci. Nam adipiscing, sem in mattis vulputate, risus libero adipiscing risus, eu molestie mi justo eget nulla. Cras venenatis metus et urna egestas non laoreet orci rutrum. Pellentesque ullamcorper dictum nisl a tincidunt. Quisque et lacus quam, sed hendrerit mi. Mauris pretium, sapien et malesuada pulvinar, lorem leo viverra leo, et egestas mi nisl quis odio. Aliquam erat volutpat. Sed urna arcu, tempus eu vulputate adipiscing, consectetur et orci. Vivamus congue, nunc vitae fringilla convallis, libero massa lacinia lorem, id convallis mauris elit ut leo. Nulla vel odio sem. Duis lorem urna, congue vitae rutrum sed, tincidunt vel tortor. In hac habitasse platea dictumst. Nunc vitae enim ante, vitae facilisis massa. Etiam sagittis sapien at nibh fermentum consectetur convallis lacus blandit.
the end.
Menu con curva
I decided to take my Pure CSS Stack Menus a step further. I took the same concept and created a jQuery UI widget for it. Now you can take any element and turn its children into the items of a stack menu. You can control when it opens and closes, the direction it opens, the size of the arc and even the time it takes to open. It even has events for those who really want to get clever.
Of course there is a catch, it only does the arcing in the browsers that support CSS transforms. But, it does degrade into a popup of the stack items in a line. As well, for those browsers that support CSS transitions, it uses this instead of the Javascript animation which creates a smoother animation while reducing the Javascript load.
Try out a demo of the jStackmenu
It is pretty simple to use. Just take any element, through jQuery, where the stack items are the children, and call .jstackmenu() on it.
$('ul.my-stack').jstackmenu(); $('span.toggle-stack').click( function(){ $('ul.my-stack').jstackmenu('toggle'); });Files
- jQuery 1.3.2
- jQuery UI 1.7.2
- Zachary Johnson’s jQuery CSS Transform
- Zachary Johnson’s jQuery Animate CSS Rotate Scale
- jStackmenu
Documentation
If you want to see any of the options, methods or events in action, use the test page for jStackmenu.
Options
- radius
- Integer Default: 1000
- The radius of the circle the menu arcs along. It has to be a positive number.
- clockwise
- Boolean Default: true, clockwise
- The rotation of the arc the menu follows. True for clockwise and then false for counter-clockwise.
- direction
- String Default: 'top'
- The direction the stack menu extend out of the container.
- time
- Integer Default: 500
- The time in milliseconds of the animation.
Methods
- toggle
- .jstackmenu( 'toggle', [switch], [callback] )
Toggles the menu visibility.
- switch: A boolean value to determine if to show or hide the menu.
- callback: A function to get called after finishing toggled.
$('#stackmenu').jstackmenu( 'toggle', function( event, menuElement ){ // Do something after toggle });- show
- .jstackmenu( 'show', [callback] )
Shows the menu.
- callback: A function to get called after finishing to show the menu.
$('#stackmenu').jstackmenu( 'show', function( event, menuElement ){ // Do something after showing });- hide
- .jstackmenu( 'hide', [callback] )
Hides the menu.
- callback: A function to get called after finishing to hide the menu.
$('#stackmenu').jstackmenu( 'show', function( event, menuElement ){ // Do something after hiding });- enable
- .jstackmenu( 'enable' )
- Enable the jStackmenu.
- disable
- .jstackmenu( 'disable' )
- Disable the jStackmenu.
- destroy
- .jstackmenu( 'destroy' )
- Remove the jStackmenu functionality completely. This will return the element back to its pre-init state.
- option
- .jstackmenu( 'option', optionName, [value] )
- Get or set any jStackmenu option. If no value is specified, will act as a getter.
Events
- show
- function( event, menuElement )
A function that is called after animating to show.
$( '#stackmenu' ).jstackmenu( { 'show': function( event, menuElement ){ // do something } } );$( '#stackmenu' ).bind( ' jstackmenushow', function( event, menuElement ){ // do something } );- hide
- function( event, menuElement )
A function that is called after animating to hide.
$( '#stackmenu' ).jstackmenu( { 'hide': function( event, menuElement ){ // do something } } );$( '#stackmenu' ).bind( ' jstackmenuhide', function( event, menuElement ){ // do something } );- showBefore
- function( event, menuElement )
A function that is called before animating to show.
$( '#stackmenu' ).jstackmenu( { 'showBefore': function( event, menuElement ){ // do something } } );$( '#stackmenu' ).bind( ' jstackmenushowBefore', function( event, menuElement ){ // do something } );- hideBefore
- function( event, menuElement )
A function that is called before animating to hide.
$( '#stackmenu' ).jstackmenu( { 'hideBefore': function( event, menuElement ){ // do something } } );$( '#stackmenu' ).bind( ' jstackmenuhideBefore', function( event, menuElement ){ // do something } );
Menú que sigue al puntero
A website navigation menu that follows the cursor, created with the jQuery library and CSS that’s easy to implement and configure. The script features simple markup, two levels navigation and styling via css. An extra feature in the script is the function that animates the page to anchor points which you can test on the single-page demo.
view demo See the script implemented on a single-page demoThe idea behind the script was to create a floating navigation that follows the moving cursor throughout the page. The goal was to make the menu itself as minimal as possible with “discreet” float animation to avoid obtrusiveness and help usability.
How to use it
Inside the head tag of your document attach the malihu.cfm.css which holds the styling for the menu and load both jquery.min.js (straight from Google) and the jquery.easing.1.3.js plugin that adds custom easing to our animations.
<link href="malihu.cfm.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script> <script src="jquery.easing.1.3.js" type="text/javascript"></script>Inside the body tag, insert the menu markup
<div id="cf_menu"> <div class="container"> <div class="title">MENU</div> <ul> <li><a href="#" onclick="Animate2id('#home');return false">↑ Home</a></li> <li><a href="#" onclick="Animate2id('#about');return false">About me</a></li> <li><a href="work">+ Work</a> <ul> <li><a href="#" onclick="Animate2id('#recent');return false">Recent</a></li> <li><a href="#" onclick="Animate2id('#web');return false">Web</a></li> <li><a href="#" onclick="Animate2id('#print');return false">Print</a></li> </ul> </li> <li><a href="#" onclick="Animate2id('#blog');return false">Blog</a></li> <li><a href="links">+ Interesting links</a> <ul> <li><a href="#" onclick="Animate2id('#freebies');return false">Freebies & Resources</a></li> <li><a href="#" onclick="Animate2id('#people');return false">People</a></li> </ul> </li> <li><a href="#" onclick="Animate2id('#contact');return false">Contact</a></li> <li><a href="info">+ Script info</a> <ul> <li><a href="http://manos.malihu.gr/cursor-following-menu/">See the post</a></li> <li><a href="http://manos.malihu.gr/tuts/cursor_following_menu.zip">↓ Download</a></li> </ul> </li> <li><a href="http://manos.malihu.gr">malihu</a></li> </ul> </div> </div>You can have a single sub-level on menu options by adding an additional unordered list inside list items.
Add the menu script and plugin at the end of the document, just before the closing body tag.
<script> //cursor following menu config $mouseover_title="+ MENU"; //menu title text on mouse-over $mouseout_title="MENU"; //menu title text on mouse-out $menu_following_speed=2000; //the speed in which the menu follows the cursor (in milliseconds) $menu_following_easing="easeOutCirc"; $menu_cursor_space=30; //space between cursor and menu $menu_show_speed="slow"; //menu open animation speed $menu_show_easing="easeOutExpo"; //menu open animation easing type $menu_hide_speed="slow"; //menu close animation speed $menu_hide_easing="easeInExpo"; //menu close animation easing type </script> <script src="malihu.jquery.cfm.js"></script>You can easily configure the menu by changing each variable to your liking.
Enjoy
License
You are free to use, study, improve and modify this script wherever and however you like.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
Wordpress plugins are licensed under GNU General Public License.Donating helps greatly in developing and updating free software and running this blog :)
Menú vertical izquierda con animación al centro(CO)
Today we will create a website template with some really sweet animations using jQuery. The idea is to have little boxes scattered around at the top of the site and when a menu item is clicked, the boxes animate to form the main content area. We will use some different animation effects ...
View demoDownload source
Today we will create a website template with some really sweet animations using jQuery. The idea is to have little boxes scattered around at the top of the site and when a menu item is clicked, the boxes animate to form the main content area. We will use some different animation effects that we will add as options to the menu item.The content area will custom scroll for which we will be using the really awesome jScrollPane Plugin by Kevin Luck. We will also use the jQuery 2d transformation plugin by Grady in order to rotate the little boxes while we animate them, and the the jQuery Easing Plugin for some spice.
The beautiful photos are by Jin. Visit his Flickr photostream at http://www.flickr.com/photos/jinthai/
So, let’s start!
The Markup
First, we want to place the background image with the grid overlay:
<div id="mb_background" class="mb_background"> <img class="mb_bgimage" src="images/default.jpg" alt="Background"/> <div class="mb_overlay"></div> </div>The next div element will be used to add the little boxes with their random position and rotation degree
<div id="mb_pattern" class="mb_pattern"></div>We will place a total of 16 boxes (div elements) into this container.
The menu and the heading will have the following HTML stucture:<div class="mb_heading"> <h1>Lack of Color</h1> </div> <div id="mb_menu" class="mb_menu"> <a href="#" data-speed="600" data-easing="easeOutBack">About</a> <a href="#" data-speed="1000" data-easing="easeInExpo">Work</a> <a href="#" data-speed="600" data-easing="easeOutBack">Media</a> <a href="#" data-speed="1000" data-easing="easeInExpo">Contact</a> </div>As you can see, we will add two “data-” attributes that we’ll use to define the speed and the easing effect that will be associated to the animation of the boxes. Read more about these new custom data attributes of HTML5 on John Resig’s blog: HTML 5 data- Attributes
Next, we will define the structure for the content area. There will be a main wrapper with the class “mb_content_wrapper” which contains all the content containers that have the class “mb_content” and a span for the closing cross:<div id="mb_content_wrapper" class="mb_content_wrapper"> <span class="mb_close"></span> <div class="mb_content"> <h2>About</h2> <div class="mb_content_inner"> <p>Some text...</p> </div> </div> <div class="mb_content"> ... </div> <div class="mb_content"> ... </div> <div class="mb_content"> ... </div> </div>One of the content elements is going to contain a list of images:
<div class="mb_content_inner"> <p>...</p> <ul id="mb_imagelist" class="mb_imagelist"> <li><img src="images/small/1.jpg" alt="image1" data-bgimg="images/image1.jpg"/></li> <li><img src="images/small/2.jpg" alt="image2" data-bgimg="images/image2.jpg"/></li> <li>...</li> </ul> <p>...</p> </div>And that’s all the HTML. Now, let’s make it pretty!
The CSS
First, we will embed our reset.css that will reset all the basic styles, and we’ll define some main properties:
@import url('reset.css'); body{ background:#000; color:#fff; font-family: 'PT Sans Narrow', Arial, sans-serif; } a{ color:#fff; text-decoration:none; }Next, we will define the styles for the image that we will use as a background and the overlay pattern:
img.mb_bgimage{ position:fixed; left:0px; top:0px; width:100%; opacity:0.8; z-index:1; } .mb_overlay{ width:100%; height:100%; position:fixed; top:0px; left:0px; background:transparent url(../images/pattern.png) repeat top left; z-index:2; }They will both be of fixed positioning and we will give them a low z-index so that they really stay under everything else.
The little boxes will all have a height and width of 50 pixel and they will have absolute positioning:
.mb_pattern div{ position:absolute; width:50px; height:50px; background:#000; z-index:10; }The main heading will also be positioned absolutely and we will use a font-face from the collection of Google Web Fonts:
.mb_heading h1{ position:absolute; top:10px; left:10px; font-size:86px; color:#000; text-shadow:0px 0px 1px #fff; font-family:"Astloch", Arial, sans-serif; z-index:4; }The menu container will be placed absolutely to the left side of the screen:
.mb_menu{ position:absolute; top:154px; left:0px; z-index:11; }The link elements inside of the menu container will be black boxes with a neat transition on hover:
.mb_menu a{ background-color:#000; margin-bottom:2px; opacity:0.9; display:block; width:98px; height:98px; color:#fff; line-height:98px; text-align:center; text-transform:uppercase; outline:none; -webkit-transition: all 0.2s ease-in; -moz-transition:all 0.2s ease-in; -o-transition: all 0.2s ease-in; -transition: all 0.2s ease-in; } .mb_menu a:hover{ color:#000; background-color:#fff; }Read more about transitions in the W3 working draft at http://www.w3.org/TR/css3-transitions/ or in this great article on A List Apart by Dan Cederholm: Understanding CSS3 Transitions.
Next step is to style the content wrapper. We will give it a fixed width and height and a semi-transparent dark background. We’ll hide it initially:
.mb_content_wrapper{ background:transparent url(../images/bg_menu.png) repeat top left; width:400px; height:400px; position:absolute; top:154px; left:200px; z-index:4; display:none; }Why don’t we just use opacity instead of a repeated background image? In some browsers all child elements will inherit that opacity level and we cannot set it higher for them. So, if we really want the inner elements to be completely opaque, it’s safer to use a background image for the surrounding container.
The little closing span will have the following style:
span.mb_close{ position:absolute; top:10px; right:10px; width:11px; height:12px; cursor:pointer; background:transparent url(../images/close.png) no-repeat top left; opacity:0.8; } span.mb_close:hover{ opacity:1.0; }The content area is going to have some padding and we’ll hide it:
.mb_content{ padding:30px; display:none; }The heading will have some background image for the stripe underline:
.mb_content h2{ font-family:"Astloch"; text-shadow:0px 0px 1px #fff; font-size:42px; background:transparent url(../images/line.png) repeat-x bottom left; padding:0px 0px 5px 0px; margin-bottom:10px; }The following container is for the resting content and it will be this element that we will apply the custom scrollbar to:
.mb_content_inner{ line-height:24px; height:268px; outline: none; } .mb_content_inner p{ padding:5px 0px; }For the thumbnail list in the “Work” section, we will have the following style:
ul.mb_imagelist li{ float:left; margin:2px; cursor:pointer; } ul.mb_imagelist li img{ display:block; opacity:0.3; -webkit-transition: all 0.5s ease-in-out; -moz-transition: all 0.5s ease-in-out; -o-transition: all 0.5s ease-in-out; -transition: all 0.5s ease-in-out; } ul.mb_imagelist li img:hover{ opacity:1.0; }As you can see, we will add some transition to it, making the thumbnail become opaque smoothly.
And that’s all the main style. (You can check out the styling for the form and the footer in the style.css file.)
Let’s add some brio to the whole thing!
The JavaScript
So the main idea is to create those little boxes and scatter them around a restricted area and rotate them. When we click on a menu item, we’ll make those boxes animate to a certain position and form the main content container. Then we’ll show the container and the respective content. When clicking on the closing span, we want to make the boxes disperse again.
In the “Works” content, we will have some thumbnails that will show a background image when clicking on them.So, let’s start by caching some elements:
var $menu = $('#mb_menu'), $menuItems = $menu.children('a'), $mbWrapper = $('#mb_content_wrapper'), $mbClose = $mbWrapper.children('.mb_close'), $mbContentItems = $mbWrapper.children('.mb_content'), $mbContentInnerItems= $mbContentItems.children('.mb_content_inner'); $mbPattern = $('#mb_pattern'), $works = $('#mb_imagelist > li'), $mb_bgimage = $('#mb_background > img'),Next, we will define the “Menu” function:
Menu = (function(){ ... })(); /* call the init method of Menu */ Menu.init();So, inside of our “Menu” function, we’ll define our main functionality, starting with a method to initialize the whole thing:
var init = function() { preloadImages(); initPlugins(); initPattern(); initEventsHandler(); },We want to preload the images that we have in the “Work” content. The data attribute in the thumbnails tells us, which images we need:
preloadImages = function() { $works.each(function(i) { $('').attr('src' , $(this).children('img').data('bgimg')); }); },
The jScollPane plugin needs to be initialized, and we’ll apply the custom scroll to the inner content area of the content div when we call this:
initPlugins = function() { $mbContentInnerItems.jScrollPane({ verticalDragMinHeight: 40, verticalDragMaxHeight: 40 }); },“initPattern” will randomly place 16 boxes (div elements) into a restricted area. We restrict that area by restricting the top and left values to a certain range:
initPattern = function() { for(var i = 0; i ').css({ opacity : o, top : t + 'px', left : l + 'px' }); if (!$.browser.msie) $el.transform({'rotate' : a + 'deg'}); $el.appendTo($mbPattern); } $mbPattern.children().draggable(); //just for fun },When we close the content area we want to move the little boxes back, scattered around randomly again:
disperse = function() { $mbPattern.children().each(function(i) { var o = 0.1, t = Math.floor(Math.random()*196) + 5, l = Math.floor(Math.random()*696) + 5, a = Math.floor(Math.random()*101) - 50; $el = $(this), param = { width : '50px', height : '50px', opacity : o, top : t + 'px', left : l + 'px' }; if (!$.browser.msie) param.rotate = a + 'deg'; $el.animate(param, 1000, 'easeOutExpo'); }); },Let’s handle the events:
initEventsHandler = function() { /* click a link in the menu */ $menuItems.bind('click', function(e) { var $this = $(this), pos = $this.index(), speed = $this.data('speed'), easing = $this.data('easing'); //if an item is not yet shown if(!$menu.data('open')){ //if current animating return if($menu.data('moving')) return false; $menu.data('moving', true); $.when(openItem(pos, speed, easing)).done(function(){ $menu.data({ open : true, moving : false }); showContentItem(pos); $mbPattern.children().fadeOut(500); }); } else showContentItem(pos); return false; }); /* click close makes the boxes animate to the top of the page */ $mbClose.bind('click', function(e) { $menu.data('open', false); /* if we would want to show the default image when we close: changeBGImage('images/default.jpg'); */ $mbPattern.children().fadeIn(500, function() { $mbContentItems.hide(); $mbWrapper.hide(); }); disperse(); return false; }); /* click an image from "Works" content item, displays the image on the background */ $works.bind('click', function(e) { var source = $(this).children('img').data('bgimg'); changeBGImage(source); return false; }); },When we click on one of the thumbnails in the “Work” section, we want the background image to change. So we define:
changeBGImage = function(img) { //if its the current one return if($mb_bgimage.attr('src') === img || $mb_bgimage.siblings('img').length > 0) return false; var $itemImage = $('<img src="'+img+'" alt="Background" class="mb_bgimage" style="display:none;"/>'); $itemImage.insertBefore($mb_bgimage); $mb_bgimage.fadeOut(1000, function() { $(this).remove(); $mb_bgimage = $itemImage; }); $itemImage.fadeIn(1000); },This shows a content item when there is already one shown:
showContentItem = function(pos) { $mbContentItems.hide(); $mbWrapper.show(); $mbContentItems.eq(pos).show().children('.mb_content_inner').jScrollPane(); },“openItem” moves the boxes from the top to the center of the page, and shows the respective content item:
openItem = function(pos, speed, easing) { return $.Deferred( function(dfd) { $mbPattern.children().each(function(i) { var $el = $(this), param = { width : '100px', height : '100px', top : 154 + 100 * Math.floor(i/4), left : 200 + 100 * (i%4), opacity : 1 }; if (!$.browser.msie) param.rotate = '0deg'; $el.animate(param, speed, easing, dfd.resolve); }); } ).promise(); };And that’s it! We really hope you enjoyed the tutorial and find it useful!