| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- $(document).ready(function(){
- //view more topic
- $('.view-more-topic a').click(function(){
- $('.content-middle-topics').css('max-height','20000px');
- //$(this).css('display','none');
- var quantity = $('.lesson-item').length;
-
- var link = $(this).attr('link')
- $.ajax({
- url: link,
- data: {
- start: quantity
- },
- type: "POST"
- }).success(function(data) {
- if(data != ''){
- $('.content-middle-topics').append(data);
- }else{
- $('.view-more-topic a').css('display','none');
- }
-
- });
- });
- //view more product intro
- $('.view-more-intro a').click(function(){
- $('.middle-intro-group-content').css('max-height','20000px');
- $(this).css('display','none');
- });
- //change product type
- $('.product-item-check').click(function(){
- var val = $(this).attr('val');
- $('.product-type').val(val);
- $('.product-item-check').removeClass('check-active');
- $(this).addClass('check-active');
- });
- // Scroll spy
- $('.header-scroll[scroll-target]').click(function(event) {
- $('.header-scroll[scroll-target].tab-active').removeClass('tab-active');
- $(this).addClass('tab-active');
- var target = $(this).attr('scroll-target');
- var positionTop = parseInt($(this).attr('scroll-position-top'));
- var position = $("#" + target).offset().top;
- $('html,body').animate({
- scrollTop: position - positionTop
- });
- });
- // Scroll
- $(document).scroll(function(){
- var docViewTop = $(window).scrollTop();
- for (var i = $('.header-scroll[scroll-target]').length - 1; i >= 0; i--) {
- var el = $('.header-scroll[scroll-target]')[i];
- var target = $(el).attr('scroll-target');
- var positionTop = parseInt($(el).attr('scroll-position-top'));
- var position = $("#" + target).offset().top;
- if( (position - positionTop - 100) <= docViewTop ){
- $('.header-scroll[scroll-target].tab-active').removeClass('tab-active');
- $(el).addClass('tab-active');
- break;
- }
- };
- var contentPos = $('.library-content-middle').offset().top;
- var footerPos = $('.footer-container').offset().top;
- if(docViewTop >= contentPos && docViewTop < (footerPos - 450)){
- $('.library-detail-content').addClass('scroll-active');
- }else{
- $('.library-detail-content').removeClass('scroll-active');
- }
- });
- });
- var tUser;
- var isStoped = false;
- function stopGetUserProduct() {
- isStoped = true;
- clearTimeout(tUser);
- }
- function getUserProduct(){
- if(!isStoped){
- tUser = setTimeout(function(){
- var link = $('.product-user').attr('link')
- $.ajax({
- url: link,
- data: {
- },
- type: "POST"
- }).success(function(data) {
- if(data != ''){
- $('.product-user').css({'bottom':'-200px','opacity':0});
- $('.product-user').html(data);
- $('.product-user').animate({'bottom':'15px','opacity':0.9}, 1300);
- setTimeout(function(){
- $('.product-user').animate({'bottom':'-200px','opacity':0}, 1300);
- getUserProduct();
- },15000)
- }
-
- });
- },15000);
- }
-
- }
|