Difference between revisions of "Template:SYSU-Software/statics/js/index.js"

 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
$(document).ready(function () {
 
$(document).ready(function () {
 +
  loadPages();
 
   let dstPage = 0;
 
   let dstPage = 0;
 
   urlSplit = window.location.href.split('?');
 
   urlSplit = window.location.href.split('?');
Line 13: Line 14:
  
 
   fkpage = $('.myfkpage').FKPageTransitions({
 
   fkpage = $('.myfkpage').FKPageTransitions({
 +
    preventDefaultSwipeY: true,
 
     startSlide: dstPage,
 
     startSlide: dstPage,
 
     mode: 35,
 
     mode: 35,
 
     mouseWheel: false
 
     mouseWheel: false
 
   });
 
   });
   initTopBar(pageList[dstPage]);
+
   let pageHeight = $(window).height();
  fkpage.goToNextSlide();
+
 
+
  let pageHeight = document.documentElement.clientHeight || document.body.clientHeight;
+
 
   let pageWidth = document.documentElement.clientWidth || document.body.clientWidth;
 
   let pageWidth = document.documentElement.clientWidth || document.body.clientWidth;
 
   (function () {
 
   (function () {
Line 27: Line 26:
 
   })();
 
   })();
  
   // $('#home-video').css('width', pageWidth + 'px');
+
 
   // $('#home-video').css('height', pageHeight + 'px');
+
   // console.log(pageHeight);
   $('#home-video')[0].play();
+
  // console.log(pageWidth);
 +
  $('#home-video').css('width', pageWidth + 'px');
 +
   $('#home-video').css('height', pageHeight + 'px');
 +
   // $('#home-video')[0].play();
  
 
});
 
});
  
let index_map = {
 
  1: 0,
 
  2: 1,
 
  3: 1,
 
  4: 1,
 
  5: 1,
 
  6: 1,
 
  7: 1,
 
  8: 1,
 
  9: 1,
 
  10: 1,
 
  11: 2,
 
  12: 2,
 
  13: 2,
 
  14: 2,
 
  15: 2,
 
  16: 3,
 
  17: 3,
 
  18: 3,
 
  19: 3,
 
  20: 3,
 
  21: 4,
 
  22: 4,
 
  23: 4,
 
  24: 4,
 
  25: 5,
 
  26: 5,
 
  27: 5,
 
  28: 5,
 
  29: 8,  /* Wet-lab */
 
  30: 8,  /* Dry-lab */
 
  31: 6,
 
  32: 6,
 
  33: 6,
 
  34: 6,
 
  35: 7,
 
  36: 7,
 
  37: 7,
 
  38: 7,
 
  39: 7,
 
  40: 8,
 
  41: 8,
 
  42: 8,
 
  43: 8
 
};
 
  
$('.myfkpage').children('li').each(function (index, ele) {
 
  let temp = index_map[index];
 
  $(this).addClass('test' + temp);
 
});
 
  
 
$('.dropdown').dropdown({
 
$('.dropdown').dropdown({

Latest revision as of 17:56, 17 October 2018

let fkpage;


$(document).ready(function () {

 loadPages();
 let dstPage = 0;
 urlSplit = window.location.href.split('?');
 if (urlSplit.length > 1) {
   dstPage = 0 + pageList.findIndex((value, index, arr) => {
     return value === urlSplit[1];
   });
 }
 // console.log(dstPage);
 fkpage = $('.myfkpage').FKPageTransitions({
   preventDefaultSwipeY: true,
   startSlide: dstPage,
   mode: 35,
   mouseWheel: false
 });
 let pageHeight = $(window).height();
 let pageWidth = document.documentElement.clientWidth || document.body.clientWidth;
 (function () {
   $('.myfkpage').css('height', pageHeight + 'px');
   // console.log(pageHeight);
 })();


 // console.log(pageHeight);
 // console.log(pageWidth);
 $('#home-video').css('width', pageWidth + 'px');
 $('#home-video').css('height', pageHeight + 'px');
 // $('#home-video')[0].play();

});


$('.dropdown').dropdown({

 action: 'select'

}); $('.ui.dropdown.link.item').on('mouseenter', function () {

 $('.ui.dropdown.link.item').not($(this)).dropdown('hide');
 $(this).dropdown('show');

});

$('#home').on('mouseenter', function () {

 // console.log('hei');
 $('.ui.dropdown.link.item').dropdown('hide');

})