Difference between revisions of "Template:BNU-CHINA/article"

Line 14: Line 14:
  
 
<script>
 
<script>
 +
$(document).ready(function () {
 +
 +
    var baseline = $("#top_menu_inside").height()
 +
 +
    $('.filter-button-group').on('click', 'li', function () {
 +
        var filterValue = $(this).attr('data-filter');
 +
        $people.isotope({filter: filterValue});
 +
    });
 +
 
     $("article h2").each(function (index, item) {
 
     $("article h2").each(function (index, item) {
 
         $("ul.sub-nav").prepend($("<li>").append(
 
         $("ul.sub-nav").prepend($("<li>").append(
Line 23: Line 32:
  
 
     $("ul.sub-nav a").click(function () {
 
     $("ul.sub-nav a").click(function () {
        console.log($("article h2")[$(this).attr("data-tartget")]);
+
         $("html, body").animate({scrollTop: $($("article h2")[$(this).attr("data-tartget")]).offset().top - $(".sub-header").height() - baseline}, "slow");
         $("html, body").animate({scrollTop: $($("article h2")[$(this).attr("data-tartget")]).offset().top - $(".sub-header").height()}, "slow");
+
 
     });
 
     });
  
Line 30: Line 38:
 
         if (($(window).scrollTop() <= $(".navbar-siren").height())) {
 
         if (($(window).scrollTop() <= $(".navbar-siren").height())) {
 
             $(".sub-header").css({
 
             $(".sub-header").css({
                 "transform": "translate3D(0, -100%, 0)",
+
                 "transform": "translate3D(0, "+baseline+"-100%, 0)",
 
             });
 
             });
 
         } else {
 
         } else {
 
             $(".sub-header").css({
 
             $(".sub-header").css({
                 "transform": "translate3D(0, 0, 0)",
+
                 "transform": "translate3D(0, "+baseline+", 0)",
 
             });
 
             });
 
         }
 
         }
 
     });
 
     });
 +
});
 
</script>
 
</script>
 
<div class="sub-header text-right">
 
<div class="sub-header text-right">

Revision as of 20:00, 17 September 2015