Difference between revisions of "Team:Cambridge-JIC/Assets/Fudge js"
(3 intermediate revisions by 2 users not shown) | |||
Line 88: | Line 88: | ||
}); | }); | ||
$(".slide-main").addClass("slide-main-mob"); | $(".slide-main").addClass("slide-main-mob"); | ||
− | /* cause i can */ $("section:not(:first-of-type)").height($(window).width()/2 + "px | + | /* cause i can */ $("section:not(:first-of-type) .slide-main").height($(window).width()/2 + "px").css("min-height", "0") |
− | + | $(".factcol-container").addClass("factcol-container-mob"); | |
} else { | } else { | ||
− | $("section:not(:first-of-type)").height("auto | + | $("section:not(:first-of-type) .slide-main").height("auto").css("min-height", "600px") |
− | + | ||
$("#hovertext").html("Hover over on a face"); | $("#hovertext").html("Hover over on a face"); | ||
$(".navsub_m").each(function() { | $(".navsub_m").each(function() { | ||
Line 116: | Line 115: | ||
}); | }); | ||
$(".slide-main").removeClass("slide-main-mob"); | $(".slide-main").removeClass("slide-main-mob"); | ||
+ | $(".factcol-container").removeClass("factcol-container-mob"); | ||
} | } | ||
$(".navbar-collapse").css("max-height", ($(window).height() - 67) + "px") | $(".navbar-collapse").css("max-height", ($(window).height() - 67) + "px") |
Latest revision as of 01:40, 19 September 2015
/*$('body').scrollspy({
target: '.bs-docs-sidebar', offset: 40
});*/ function hndl(me) {
if ($(me).parent().children("div").is(':visible')) { $(".navsub_m").hide() } else { $(".navsub_m").hide() $(me).parent().children("div").show() }
}
String.prototype.endsWith = function(suffix) {
return ~this.indexOf(suffix, this.length - suffix.length);
};
$(window).ready(function() {
//if($("#notebook").length == 1) return;
$(window).on("resize", function() {
// highlight curr page if (!window.location.href.match(/501/g)) { if ($(window).width() < 768) { $("a").each(function() {
if (~$(this).parent().parent().parent().prop("className").indexOf("nhs")) { $(this).parent().parent().parent().attr("class", "navsub"); $(this).parent().parent().parent().parent().attr("class", ""); $(this).parent().attr("class", ""); }
if (~$(this).parent().prop('className').indexOf("nh")) { $(this).parent().attr("class", ""); }
});
} }
$(".nh").children(".navsub").addClass("nhs")
if ($(".navbar-toggle").is(":visible")) { $("#hovertext").html("Tap on a face"); $(".navsub").each(function() { $(this).removeClass("navsub"); $(this).addClass("navsub_m"); $(this).hide(); $(this).data("link", $(this).parent().children("a").attr("href")); $(this).parent().children("a").attr("href", "#"); $(this).parent().children("a").attr("onclick", "hndl(this)"); }); $(".slide").each(function() { if ($(this).data("mobile") == null) { $(this).data("mobile", 1) //$(this).css("background-size", ""); //$(this).data("width", $(this).width()); //$(this).width("auto")
//$(this).data("minheight", $(this).css("min-height")); //$(this).css("min-height", "0px")
$(this).children("div").data("fsz", $(this).children("div").css("font-size")); $(this).children("div").css("font-size", "12pt")
$(this).children("div").data("ml", $(this).children("div").css("margin-left")); //$(this).children("div").css("margin-left", "30px")
$(this).children(".padleft").data("pl", $(this).children(".padleft").css("padding-left")); $(this).children(".padleft").css("padding-left", "50px")
$(".team .face .profile p").data("fsz", $(".team .face .profile p").css("font-size")); $(".team .face .profile p").css("font-size", "90%")
//$(this).data("img", $(this).css("background-image"));
//mobimg = $(this).data("mobimg") //$(this).css("background-image", (mobimg == null? "none":mobimg)) } }); $(".slide-main").addClass("slide-main-mob"); /* cause i can */ $("section:not(:first-of-type) .slide-main").height($(window).width()/2 + "px").css("min-height", "0") $(".factcol-container").addClass("factcol-container-mob"); } else {
$("section:not(:first-of-type) .slide-main").height("auto").css("min-height", "600px") $("#hovertext").html("Hover over on a face"); $(".navsub_m").each(function() { $(this).removeClass("navsub_m"); $(this).show() $(this).addClass("navsub"); $(this).parent().children("a").attr("href", $(this).data("link")); $(this).parent().children("a").attr("onclick", ""); }) $(".slide").each(function() { $(this).css("background-size", ""); if ($(this).data("mobile") == 1) { $(this).data("mobile", null) //$(this).width($(this).data("width")+"px") //$(this).css("background-image", $(this).data("img")) //$(this).css("min-height", $(this).data("minheight")) $(this).children("div").css("font-size", $(this).children("div").data("fsz")) //$(this).children("div").css("margin-left", $(this).children("div").data("ml")) $(this).children(".padleft").css("padding-left", $(this).children(".padleft").data("pl")) $(".team .face .profile p").css("font-size", $(".team .face .profile p").data("fsz")) } }); $(".slide-main").removeClass("slide-main-mob"); $(".factcol-container").removeClass("factcol-container-mob"); } $(".navbar-collapse").css("max-height", ($(window).height() - 67) + "px")
//reset highlighted page
if (!window.location.href.match(/501/g)) {
if ($(window).width() >= 768) {
$("a").each(function() { hr = $(this).attr("href");
if (hr && hr.match(/\/\/2015/g) && !hr.match(/http:/g)) { url = 'http://' + window.location.hostname + window.location.pathname; if (url.endsWith(hr)) {
if (~$(this).parent().parent().prop('className').indexOf("nav")) { $(this).parent().attr("class", "nh"); }
if ($(this).parent().parent().parent().prop('className') == "navsub") { $(this).parent().parent().parent().attr("class", "nhs"); $(this).parent().parent().parent().parent().attr("class", "nh"); $(this).parent().attr("class", "nh"); }
} }
});
}
}
});
// janky $("a").each(function() { hr = $(this).attr("href");
if (hr && hr.match(/\/\/2015/g) && !hr.match(/http:/g)) { url = 'http://' + window.location.hostname + window.location.pathname; if (url.endsWith(hr)) {
if (~$(this).parent().parent().prop('className').indexOf("nav")) { $('.slide').each(function(){ $(this).addClass('slide-main'); }); $(".slide").click(function() { if ($(".navbar-toggle").is(":visible")) { as = $(this).find('a'); if (as.length) { window.location.href = as[0].href; } } }); }
} }
})
$(window).resize();
$(".face").on("click", facepalm) $(".profile").on("mouseover", function() { facepalm() $(this).addClass("profilehovered"); $(this).css("opacity", 1); })
$(".profile").on("mouseout", function() { $(".blur").removeClass("facehovered"); $(".profile").removeClass("profilehovered"); $(".profile").css("opacity", 0); })
$("img").each(function() {
if ($(this).parent().prop('nodeName') != 'a') { $(this).on("click", function() { window.location = $(this).attr("src") }); $(this).css('cursor', 'pointer'); }
});
});
function facepalm() {
$(".blur").removeClass("facehovered"); $(".profile").removeClass("profilehovered"); $(".profile").css("opacity", 0);
$(this).children(".blur").addClass("facehovered"); $(this).children(".profile").addClass("profilehovered"); $(this).children(".profile").css("opacity", 1);
}