| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- //Slider
- $(document).ready(function(){
- var width = $(".home-student-list").width();
- $("#home-student-slider").css('width', width);
- $("#home-student-slider .slider-container-cover").css('width', width);
- var options = { $AutoPlay: 1,
- $SlideSpacing: 25
- };
- if($("#home-student-slider").length > 0){
- var jssor_slider1 = new $JssorSlider$('home-student-slider', options);
- }
- });
- //Slider
- $(document).ready(function(){
- var itemWidth = 260;
- var maxCol = 3;
- var spacing = 30;
- var width = $(".home-product-list").width();
- var number = $("#home-product-slider .slider-container-cover .home-library-product").length;
- var colSuggest = Math.min(Math.ceil(width/(itemWidth + 30)), maxCol);
- var col = Math.min(Math.floor(width/(itemWidth + 30)), maxCol)
- var colSlider = colSuggest;
- if(number == 1 && col == 0){
- $('.home-library-product').css({
- 'margin-left': '0px',
- 'margin-right': '0px'
- });
- }else if(number == 1 && col == 1){
- colSuggest = 1;
- colSlider = 1;
- }else if(number <= col){
- colSuggest = number;
- colSlider = number;
- }else if(number == colSuggest){
- colSlider = number - 1;
- if(colSlider == 1){
- colSuggest = 1;
- }
- }
- console.log(colSlider);
- width = Math.min(itemWidth*colSuggest + spacing*colSuggest, width);
-
- $("#home-product-slider").css('width', width);
- $("#home-product-slider .slider-container-cover").css('width', width);
- var options2 = { $AutoPlay: 1,
- $SlideWidth: itemWidth,
- $SlideHeight: 340,
- $SlideSpacing: 30,
- $Cols: colSlider,
- $Align: width/2 - itemWidth/2 - 15,
- $BulletNavigatorOptions: {
- $Class: $JssorBulletNavigator$,
- $SpacingX: 10
- }
- };
- if($("#home-product-slider").length > 0){
- var jssor_slider2 = new $JssorSlider$('home-product-slider', options2);
- }
- var textHeight = $('.home-project-info-cover').innerHeight();
- $('.home-project-info-cover').css('height', '210px');
- $('.home-project-container .button-more').click(function(event) {
- if($('.home-project-info-cover').hasClass('cover-show')){
- $('.home-project-info-cover').animate({height: '210px'}, 400);
- $('.home-project-info-cover').removeClass('cover-show');
- $(this).find('.button-text').text($(this).find('.button-text').attr('langmore'));
- $(this).find('i').css({transform: 'rotate(0deg)'});
- }else{
- $('.home-project-info-cover').animate({height: textHeight + 'px'}, 400);
- $('.home-project-info-cover').addClass('cover-show');
- $(this).find('.button-text').text($(this).find('.button-text').attr('langless'));
- $(this).find('i').css({transform: 'rotate(180deg)'});
- }
-
- });
- });
- // Video
- // 2. This code loads the IFrame Player API code asynchronously.
- var tag = document.createElement('script');
- tag.src = "https://www.youtube.com/iframe_api";
- var firstScriptTag = document.getElementsByTagName('script')[0];
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
- // 3. This function creates an <iframe> (and YouTube player)
- // after the API code downloads.
- var player;
- var playerWidth = 470;
- function onYouTubeIframeAPIReady() {
- player = new YT.Player('player-video', {
- height: '100%',
- width: '100%',
- videoId: "Ixkd3pLIlY4",
- playerVars: {
- autoplay: 0,
- controls: 0,
- showinfo: 0,
- playsinline: 1,
- rel: 0
- },
- events: {
- // 'onReady': onPlayerReady,
- // 'onStateChange': onPlayerStateChange
- }
- });
- }
- $(document).on('click', '#home-video .layout-video', function(){
- if( isFunction(player.getPlayerState) ){
- if(player.getPlayerState() == 1){
- player.pauseVideo();
- $("#home-video .layout-video").removeClass('hide-layout');
- }else{
- player.playVideo();
- $("#home-video .layout-video").addClass('hide-layout');
- }
- }
-
- });
- function isFunction(functionToCheck) {
- return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
- }
|