Difference between revisions of "Team:Oxford/Assets/contents"
Line 52: | Line 52: | ||
} | } | ||
}); | }); | ||
− | } | + | }; |
$('#notebook-key-button').click(function() { | $('#notebook-key-button').click(function() { | ||
Line 65: | Line 65: | ||
keyClicked = true; | keyClicked = true; | ||
}; | }; | ||
− | }) | + | }); |
$('#notebook-key-button').on('affix-bottom.bs.affix', function () { | $('#notebook-key-button').on('affix-bottom.bs.affix', function () { | ||
Line 73: | Line 73: | ||
keyClicked = false; | keyClicked = false; | ||
} | } | ||
− | }) | + | }); |
$(window).resize(function() { | $(window).resize(function() { | ||
$('#sidebar').affix('checkPosition'); | $('#sidebar').affix('checkPosition'); | ||
$('#notebook-key-button').affix('checkPosition'); | $('#notebook-key-button').affix('checkPosition'); | ||
− | }) | + | }); |
$('.image').click(function() { | $('.image').click(function() { | ||
Line 95: | Line 95: | ||
imageClicked = false; | imageClicked = false; | ||
} | } | ||
− | }) | + | }); |
$('.definition').popover({ | $('.definition').popover({ | ||
trigger:'click', | trigger:'click', | ||
placement:'auto top' | placement:'auto top' | ||
− | }) | + | }); |
} | } | ||
$(document).ready(main); | $(document).ready(main); |
Revision as of 14:40, 17 September 2015
var main = function() {
var imageClicked = false; var keyClicked = false; var isiPhone = navigator.userAgent.toLowerCase().indexOf("iphone"); var isiPad = navigator.userAgent.toLowerCase().indexOf("ipad"); var isiPod = navigator.userAgent.toLowerCase().indexOf("ipod");
if(isiPhone > -1){ //Redirect to iPhone Version of the website. $('.page-heading').addClass("ios"); $('#title').addClass("ios"); } if(isiPad > -1){ $('.page-heading').addClass("ios"); $('#title').addClass("ios"); } if(isiPod > -1){ $('.page-heading').addClass("ios"); $('#title').addClass("ios"); }
$('body').scrollspy({ target: '.contents-sidebar', offset: 16 });
if ($('#sidebar').length > 0) { $('#sidebar').affix({ offset: { top: $('#sidebar').offset().top - 90, } }); }
$('#solution-byline > h3 > a').click(function(){ $('body').animate({scrollTop:$('.info-container:visible:first').offset().top}, 400); });
$('.next-section-btn').click(function(){ $('body').animate({scrollTop:$(this).parent().next().offset().top},400); return false; });
$('a[href*=#]').click(function(){ $('body').animate({scrollTop:$( $.attr(this, 'href') ).offset().top},400); });
if ($('#notebook-key-button').length > 0) { $('#notebook-key-button').affix({ offset: { bottom: $('#foot').height() + $('#notebook-key-button').outerHeight(true) } }); };
$('#notebook-key-button').click(function() { if (keyClicked) { $('#notebook-key').removeClass("active"); $('#notebook-key-button').removeClass("active"); keyClicked = false; } else { $('#notebook-key').addClass("active"); $('#notebook-key-button').addClass("active"); keyClicked = true; }; });
$('#notebook-key-button').on('affix-bottom.bs.affix', function () { if (keyClicked) { $('#notebook-key').removeClass("active"); $('#notebook-key-button').removeClass("active"); keyClicked = false; } });
$(window).resize(function() { $('#sidebar').affix('checkPosition'); $('#notebook-key-button').affix('checkPosition'); });
$('.image').click(function() { if (imageClicked) { $('.image').removeClass("lightbox"); imageClicked = false; } else { $(this).addClass("lightbox"); imageClicked = true; } }); $(document).scroll(function() { if(imageClicked) { $('.image').removeClass("lightbox"); imageClicked = false; } }); $('.definition').popover({ trigger:'click', placement:'auto top' });
}
$(document).ready(main);