Skip to content

Instantly share code, notes, and snippets.

@ozknozsrt
Created October 2, 2015 09:00
Show Gist options
  • Save ozknozsrt/65a6bde471f63ad95f38 to your computer and use it in GitHub Desktop.
Save ozknozsrt/65a6bde471f63ad95f38 to your computer and use it in GitHub Desktop.
stickyMenu: function() {
if ($("body").hasClass("boxed")) return !1;
var a = $("body header:first"),
b = a.height(),
e = a.find(".logo"),
d = a.find(".logo img"),
k = d.width(),
l = d.height(),
m = this;
d.css("height", 40);
var g = d.width();
d.css("height",
"auto").css("width", "auto");
var f = $("header.flat-menu ul.nav-main > li > a");
m.checkStickyMenu = function() {
if ($("body").hasClass("boxed")) return !1;
if ($(window).scrollTop() > b - 15 - 40 && 991 < $(window).width()) {
if ($("body").hasClass("sticky-menu-active")) return !1;
d.stop(!0, !0);
$("body").addClass("sticky-menu-active").css("padding-top", b);
f.addClass("sticky-menu-active");
e.addClass("logo-sticky-active");
d.animate({
width: g,
height: 40,
top: "28px"
}, 200, function() {})
} else $("body").hasClass("sticky-menu-active") &&
($("body").removeClass("sticky-menu-active").css("padding-top", 0), f.removeClass("sticky-menu-active"), e.removeClass("logo-sticky-active"), d.animate({
width: k,
height: l,
top: "0px"
}, 200, function() {
d.css({
width: "auto",
height: "auto"
})
}))
};
$(window).on("scroll", function() {
m.checkStickyMenu()
});
m.checkStickyMenu()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment