Sunday 15 February 2015

jquery - making movable items in html and the menu items slide smoothly -



jquery - making movable items in html and the menu items slide smoothly -

this extension of next question making movable menu items in html

here using navigation menu

<ul id="menu"> <li><a href="/home">home</a></li> <li><a href="/services">services</a></li> <li><a href="/contact">contact</a></li> <li><a href="/about">about</a></li> </ul>

the problem here is not retrieving values after page refresh static page working fine. menu items has slide smoothly

any help ?

use jquery cookie store order of li.

see sample : fiddle

$(function () { if ($.cookie('menuorder') != null) { var menuorder = $.cookie('menuorder').split(','); var li = $('#menu li'); li.detach().sort(function (a, b) { homecoming (menuorder.indexof($(a).text()) > menuorder.indexof($(b).text())); }); $('#menu').append(li); } $('#menu ').on('click', 'li', function (event) { $(event.target).prependto('#menu '); $.cookie('menuorder', $('#menu li ').map(function () { homecoming $(this).text(); }) .get() .join()); }); });

jquery html css

No comments:

Post a Comment