javascript - Fullpage jquery navigation -
javascript - Fullpage jquery navigation -
good day guys. got little question here.
kindly check link http://www.thepetedesign.com/demos/fullpagenav_demo.html
how can create transition of hovering out more smoother more http://outdatedbrowser.com/
i'm designer , know tiny bit jquery think smoothness can inserted here?
.mouseleave(function() { if (!li.find(".fpn_wrap").hasclass("fpn_clicked")) { $(this).removeclass("active") el.recalculate(settings, width); el.find(".fpn_wrap").finish().css({width: "100%"}) } });
here's total code
!function($){ var defaults = { columns: 5, selector: "> li", hover_size: "30%", animateduration: 500, animatefrom: "left", clickable: true, afterclicked: null }; $.fn.recalculate = function(settings, width) { var el = $(this), active = false, total = el.find(settings.selector).length, last_pos = 0, total_width = 0; if(el.find(".fpn_li.active").length > 0) { el.find(".fpn_li.active").css({ width: settings.hover_size }); var small_width = (100 - parsefloat(settings.hover_size))/(settings.columns - 1) el.find(".fpn_li:not(.active)").css({ width: small_width + "%" }); el.find(settings.selector).each(function( index, value ) { if ($(this).prev(".fpn_li").length > 0) { if($(this).prev(".fpn_li").hasclass("active")) { var w = settings.hover_size } else { var w = small_width } var left = total_width + parsefloat(w) $(this).finish().animate({ left: left + "%" }, settings.animateduration, function() { $(this).css({ left: left + "%" }); }) total_width = total_width + parsefloat(w) } }); } else { el.find(settings.selector).each(function( index, value ) { $(this).finish().animate({ width: width + "%", left: (width * index) + "%" }, settings.animateduration); }); } } function determinedirection($el, pos){ var w = $el.width(), middle = $el.offset().left + w/2; homecoming (pos.pagex > middle ? 0 : 1); } $.fn.fullpagenav = function(options){ var settings = $.extend({}, defaults, options), el = $(this), width = 100 / settings.columns; el.addclass("fullpagenav").find(settings.selector).addclass("fpn_li") el.parent().addclass("fpn_body") el.find(settings.selector).each(function( index, value ) { var li = $(this); li.css({ width: width + "%", left: (width * index) + "%" }); li.wrapinner("<div class='fpn_wrap'></div>") if (settings.clickable == true && li.data("link")) { li.css({cursor: "pointer"}).click(function(e) { if (!li.find(".fpn_wrap").hasclass("fpn_clicked")) { li.find(".fpn_wrap > img").css({ margin: 0, padding: 0, left: 0, maxheight: "inherit" }).animate({ width: "100%" }) li.find(".fpn_wrap").addclass("fpn_clicked").css({position: "fixed", "z-index": 99}).finish().animate({ width: "100%", top: 0, left: 0 }, settings.animationduration, function() { e.preventdefault() if (typeof settings.afterclicked == 'function') homecoming settings.afterclicked(li.data("link")); window.location.href = li.data("link"); }); } else { li.find(".fpn_wrap").removeclass("fpn_clicked").finish().animate({ width: "0%", top: 0, left: 0, height: "0%" }, settings.animationduration, function() { $(this).attr("style","").find("> img").attr("style","") }) } }); } li.mouseenter(function(e) { if (!li.find(".fpn_wrap").hasclass("fpn_clicked")) { $(this).finish().addclass("active") el.recalculate(settings, width); if (settings.animatefrom == "auto") { if(determinedirection(li, e) == 1) { $(this).find(".fpn_wrap").finish().css({ float: "left"}).animate({width: el.find(".fpn_li.active").width()}, settings.animateduration) } else { $(this).find(".fpn_wrap").finish().css({ float: "right"}).animate({width: el.find(".fpn_li.active").width()}, settings.animateduration) } } else { $(this).find(".fpn_wrap").finish().css({ float: settings.animatefrom}).animate({width: el.find(".fpn_li.active").width()}, settings.animateduration) } } }).mouseleave(function() { if (!li.find(".fpn_wrap").hasclass("fpn_clicked")) { $(this).removeclass("active") el.recalculate(settings, width); el.find(".fpn_wrap").finish().css({width: "100%"}) } }); }); } }(window.jquery);
thanks : )
javascript jquery css3
Comments
Post a Comment