var hifiModule = 'PG1000000018'; function getLanding(data){ shareMsg = ''; if (data.resultCode=='99'){ loadingOff(); }else if ((data.resultCode=='0' || data.resultCode=='11') ){ hash = ''; $('#loading').fadeOut(800); $('.sortingbar').remove(); $('#submenu ul').html(''); var content = ''+ //'
'+ '
'; $('#contentArea').append(content); // recently played section var activeAjaxCall_recentlyPlayed = '' $.support.cors=true var getRecentlyAPI = domainList.recentPlayServer +'/metadata/history/getProfileWithSummary?deviceType=web®ion=HK&langCode=zh_HK'; //console.log(getRecentlyAPI) $.ajax({ type: 'GET', url: getRecentlyAPI, data: '', dataType: 'json', crossDomain: crossDomain, async:false, xhrFields: { withCredentials: true }, success: function(data) { //console.log(data) if(data.resultCode == "0" && data.dataObject.historyList.length >0){ // ajaxCall(apiServer+'/moov/api/sync/getSyncData?refType=VDO&start=0&end=40&orderBy=addtime&order=desc','',getCollectioncRecentlyPlayedCallback); // //var text = getCollectionDetails(data.dataObject[0].refType, data); // //$('.content-c .element').append(text); // $('.content-c').append('
'); // $('#i0_recently_played').append('
'); getRecentlyInitial(); getRecentlyPlayedGrid(data) } else { //console.log("error func .....") } }, error: function (responseData, textStatus, errorThrown) { //console.log("error func .....") if(responseData.readyState==0){ showMessage(langJSON.error_message.the_network_connection_is_unstable_now); } }, cache:false }); // recently played section //console.log(data.dataObject) for(var i=0;i'; if (data.dataObject[i].background.path != '' && data.dataObject[i].background.path != undefined){ hasBackground = true; chart += '
'; //console.log(data.dataObject[i].background.path) } if (displayType == 'list'){ var screenWidth = $(window).width(); var slickwidth = 1104; var slickLeft = 30; if(screenWidth < 1440 && screenWidth > 995){ slickwidth = screenWidth*0.9-192; slickLeft = (screenWidth*0.2166+30)-(screenWidth*0.0666)-216; }else if(screenWidth <= 995){ slickwidth = 704; slickLeft = -37; } chart += ''; } chart += '
'; if(data.dataObject[i].refValue != hifiModule){ $('.content-c').append(chart); if(hasBackground){ $("#i"+i).addClass('highlight'); } } var moduleTitle = ''; var moduleDesc = ''; var color = data.dataObject[i].nameColor; var descColor = data.dataObject[i].descColor; var link = ''; //HOLY SHIT~!!!!16/7/2015 if(displayType == 'grid' || displayType == 'block'){ //console.log(data.dataObject[i]) moduleTitle = data.dataObject[i].chiName; moduleDesc = data.dataObject[i].chiDesc; link = getMenuPath(data.dataObject[i].refType,data.dataObject[i].refValue); if(data.dataObject[i].refType == 'WEB'){ link = webprofileRedirect+'?mk='+((userData == null)?'':userData.userId)+'&id='+data.dataObject[i].refValue+'" target="_blank'; } if(lang == 'eng'){ moduleTitle = data.dataObject[i].engName; moduleDesc = data.dataObject[i].engDesc; } } if(displayType == 'list'){ for (var j=0; j 0){ $('#b'+i+' .landing-list').slick({ dots: false, infinite: false, slidesToShow: 2, slidesToScroll: 2, lazyLoad: 'ondemand' }); } } addFavouriteFunction(); setSlickWidth(); $('.lazy').Lazy(); } if(MOOVPlayer.playList.length!=0){ $('.moduleList .l-r[data-refId="'+MOOVPlayer.playList[MOOVPlayer.currentPlayingItem].pid+'"]').addClass('playing'); } if(MOOVVideoPlayer.playList.length!=0){ $('.moduleList .l-r[data-refId="'+MOOVVideoPlayer.playList[MOOVVideoPlayer.currentPlayingItem].pid+'"]').addClass('playing'); } //var landingHeight = $("#contentArea").height()+150; //$("#landing").css({'height': landingHeight+'px', 'background-color' : '#ffffff' }); $('.sortingbar').remove(); } function getRecentlyInitial(){ var x = getCookie("MOOVUID") if(x != null){ ajaxCall(cloudSyncServer+'/moov/api/sync/getSyncData?refType=VDO&start=0&end=40&orderBy=addtime&order=desc','',getCollectioncRecentlyPlayedCallback); $('.content-c').append('
'); $('#i0_recently_played').append('
'); } } function getLandingModuleType(module, displayType, type, target, color, descColor, moduleTitle, moduleDesc, link, hasBackground){ if (displayType == 'banner' ){ getLandingBanners(module, 'i'+target, hasBackground); } else if (displayType == 'list'){ getLandingList(module, type, 'i'+target, color, descColor, hasBackground); } else if (displayType == 'grid'){ getLandingGrid(module, type, 'i'+target, moduleTitle, moduleDesc, color, descColor, link, hasBackground); } else if (displayType == 'block'){ getLandingBlock(module, type, 'i'+target, moduleTitle, moduleDesc, color, descColor, link, hasBackground); } } function getLandingModule (data){ if (data.products){ return data.products; }else if (data.chartItems){ return data.chartItems; }else if (data.albums){ return data.albums; }else if (data.artists){ return data.artists; }else if (data.profiles){ return data.profiles; }else if (data.banners){ return data.banners; } } function getLandingBanners(data, target, hasBackground){ //console.log(data) var topBanner = ""; var screenWidth = $(window).width(); var bannerWidth = 1440; var bannerLeft = -342; if(screenWidth < 1440 && screenWidth > 1080){ bannerWidth = screenWidth; bannerLeft = -(screenWidth*0.2167)-40; }else if(screenWidth <= 1080){ bannerWidth = 1080; //bannerLeft = -246; bannerLeft = -274; } topBanner += ''; $("#"+target).append(topBanner); /* var width = $( window ).width(); var temp = 0; if (width >= 1440){ temp = (width - 1440)/2; } $("#sliderFrame").attr("style","margin-left: "+temp+"px !important"); */ //ANIME SETTINGS if((window.ActiveXObject || "ActiveXObject" in window) && (navigator.userAgent.indexOf('Windows NT 10.0') > 0 || navigator.userAgent.indexOf('Windows NT 6.3') > 0 || navigator.userAgent.indexOf('Windows NT 6.2') > 0) ){ $('#b'+target+' .landing-slider').slick({ /*slidesToShow: 1, slidesToScroll: 1, infinite: true, draggable: false,*/ dots: true, autoplay: true, autoplaySpeed: 3000 }); }else{ $('#b'+target+' .landing-slider').slick({ /*slidesToShow: 1, slidesToScroll: 1, infinite: true, draggable: false,*/ dots: true, fade: true, autoplay: true, autoplaySpeed: 3000 }); } /* $('#b'+target+' .landing-slider').hover('mouseenter', function(){ $('#b'+target+' .landing-slider').slick("slickPlay"); }); */ $('#b'+target+' .landing-slider').on('mouseleave', function(){ $('#b'+target+' .landing-slider').slick("slickPlay"); }); } function getLandingList(data, type, target, color, descColor, hasBackground){ var moduleId; if(typeof data.toRefValue != 'undefined' && data.toRefValue.trim() != ''){ moduleId = data.toRefValue; }else{ moduleId = data.moduleId; } var link = getMenuPath(data.toRefType, moduleId); var chartType = data.chartType; var pageid = 121; var name = data.chiName; if(lang == 'eng'){ name = data.engName; } if (chartType == 'product'){ pageid = 11; } var chart = '
'+ '
'+name+''; if(data.more == 'Y' && data.more != undefined && data.toRefType != "" && data.toRefType != undefined && moduleId != "" && moduleId != undefined ){ chart += '
'+langJSON.general.more+' >
'; } chart += '
'+ //'
'+ '
'; var module = getLandingModule(data); var isChart = false; if(data.moduleType == 'CL'){ //isChart = true; if(data.chartType=='product'){ var shareMsg='更多最新專輯,盡在MOOV音樂App'; for (var i=0; i'+artistsName[j]+', '; } } artists=artists.substring(0, artists.length-2); */ if(product.artists.length > 0){ for(var j=0 ;j'+product.artists[j].name+''; if(j != product.artists.length -1){ artists += ', '; } } } var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'; if(i != 0){ chart += i+1; }else{ chart += ''; } chart += '
'; var playFunction = ''; if(product.productType == 'AUDIO'){ if(data.toRefValue.trim() == ''){ playFunction = 'playModuleItem(\'LND\',\''+data.moduleType+'\',\''+moduleId+'\','+i+',true)'; }else{ playFunction = 'playByChart(\''+moduleId+'\','+i+')'; } chart += '
'+ ''+title.replace(/\'/g, '; }else{ playFunction = 'instantPlayVideo(\''+product.productId+'\')'; chart += ''+title.replace(/\'/g, '; } chart += '
'+ ''+ '
'+ '
'+toMinutes(product.productLength)+'
'+ '
'+explicit+'
'+ '
'+ '
'+ //''+ //'
'+ ''+ '
'+ '
'+ '
'; } }else if(data.chartType=='artist'){ var shareMsg='更多不同歌手的音樂,盡在MOOV音樂App'; for (var i=0; i'+artistsName[j]+', '; } } artists=artists.substring(0, artists.length-2); var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'; if(i != 0){ chart += (i+1); }else{ chart += ''; } chart += '
'+ '
'+ '
'+ //'
'+artists+'
'+ '
'+artists+'
'+ '
'+ '
'+ //''+ ''+ //'
'+ '
'+ '
' } }else if(data.chartType=='album'){ var shareMsg='更多最新專輯,盡在MOOV音樂App'; for (var i=0; i'+artistsName[j]+', '; } } */ //artists=artists.substring(0, artists.length-2); if(product.artists.length > 0){ for(var j=0 ;j'+product.artists[j].name+''; if(j != product.artists.length -1){ artists += ', '; } } } var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'; if(i != 0){ chart += (i+1); }else{ chart += ''; } chart += '
'+ '
'+ ''+ '
'+ //''+ ''+ //'
'+ '
'+ '
' } } }else if(data.moduleType == 'PL'){ var shareMsg='更多精采歌單,盡在MOOV音樂App'; //isChart = true; if(data.type=='AUDIO'){ for (var i=0; i'+artistsName[j]+', '; } } artists=artists.substring(0, artists.length-2); */ if(product.artists.length > 0){ for(var j=0 ;j'+product.artists[j].name+''; if(j != product.artists.length -1){ artists += ', '; } } } var playFunction = 'playByPlayList(\''+moduleId+'\','+i+')'; if(data.toRefValue.trim() == ''){ playFunction = 'playModuleItem(\'LND\',\''+data.moduleType+'\',\''+moduleId+'\','+i+',true)'; } var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'+ ''; /* if(i != 0){ chart += i+1; }else{ chart += ''; } */ //chart += '
'+ chart += ''+ '
'+ '
'+toMinutes(product.productLength)+'
'+ '
'+explicit+'
'+ '
'+ '
'+ //''+ //'
'+ ''+ '
'+ '
'+ '
' } }else if(data.type=='VIDEO'){ for (var i=0; i 0){ for(var j=0 ;j'+product.artists[j].name+''; if(j != product.artists.length -1){ artists += ', '; } } } var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'+ ''+ '
'+ '
'+toMinutes(product.productLength)+'
'+ '
'+explicit+'
'+ '
'+ '
'+ //''+ //'
'+ ''+ '
'+ '
'+ '
' } }else if(data.chartType=='artist'){ var shareMsg='更多不同歌手的音樂,盡在MOOV音樂App'; for (var i=0; i'+artistsName[j]+', '; } } artists=artists.substring(0, artists.length-2); var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'+ '
'; if(i != 0){ chart += (i+1); }else{ chart += ''; } chart += '
'+ '
'+ //'
'+artists+'
'+ '
'+artists+'
'+ '
'+ '
'+ //''+ ''+ //'
'+ '
'+ '
' } }else if(data.chartType=='album'){ var shareMsg='更多最新專輯,盡在MOOV音樂App'; for (var i=0; i'+artistsName[j]+', '; } } */ //artists=artists.substring(0, artists.length-2); if(product.artists.length > 0){ for(var j=0 ;j'+product.artists[j].name+''; if(j != product.artists.length -1){ artists += ', '; } } } var explicit= ''; if(product.explicit != undefined && product.explicit != ''){ explicit = (product.explicit=='0' ||product.explicit=='N')?'':''; } chart +='
'+ '
'+ '
'; if(i != 0){ chart += (i+1); }else{ chart += ''; } chart += '
'+ ''+ '
'+ //''+ ''+ //'
'+ '
'+ '
' } } }else if(data.moduleType == 'RAT' || data.moduleType.substring(0,3) == 'RAT'){ var shareMsg='更多最新專輯,盡在MOOV音樂App'; for (var i=0; i'; var image = module[i].thumbnail; var title = module[i].artist; chart += '
'; var explicit= ''; chart += ''+ '
'+ // '
'+explicit+'
'+ // '
'+toMinutes(module[i].productLength)+'
'+ '
'+ '
'+ //''+ ''+ //'
'+ '
'+ /*'
'+*/ '
'; //} } }else{ for (var i=0; i'; if(showPlayButton){ chart +=''; } chart += ''; if (isChart){ chart += '
'+(i+1)+'
'; } var explicit= ''; if(module[i].explicit != undefined && module[i].explicit != ''){ explicit = (module[i].explicit=='0' ||module[i].explicit=='N')?'':''; } chart += ''+ '
'+ '
'+explicit+'
'+ '
'+productLength+'
'+ '
'+ '
'+ //''; ''; if(showAddPlaylist){ //chart += '
'; chart += '
'; } chart += '
'+ /*'
'+*/ ''; //} } } chart += ''; $("#"+target+" .landing-list").append(chart); $("#landing .moduleList .l-r .song .singer a").click(function(event){ stopPropagation(event); playerOff(); }); } function checkRecentlyPlayedItemVisibility(obj){ index = obj.length - 1; while (index >= 0) { console.log(obj[index]) if (obj[index].profileId=='') { obj.splice(index, 1); } else if(obj[index].profileType != 'STAR_VIDEO' && obj[index].profileType != 'STAR_AUDIO') { if(obj[index].name == '' ){ obj.splice(index, 1); } } index -= 1; } return obj; } // recenltly async function getRecentlyPlayedGrid(dataObj){ // $('.content-c').append('
'); // $('#i0_recently_played').append('
'); //console.log(dataObj.dataObject.historyList) var historyListArr = dataObj.dataObject.historyList; var text = ''; //var name = data.chiName; var moreImage = ''; var defaultImage = ''; // if(lang == 'eng'){ // name = data.engName; // } var screenWidth = $(window).width(); var slickwidth = 1104; var slickLeft = 30; if(screenWidth < 1440 && screenWidth > 995){ slickwidth = screenWidth*0.9-192; slickLeft = (screenWidth*0.2166+30)-(screenWidth*0.0666)-216; }else if(screenWidth <= 995){ slickwidth = 704; slickLeft = -37; } var welcomeMsg = ''; var welcomeMsg_UserName = 'Hello'; if(lang == 'eng'){ welcomeMsg = ", music you’ve recently played"; } else if (lang == 'chi') { welcomeMsg = ",你最近聽過"; } //console.log(userData.nickname) if(!!userData && userData.nickname != ''){ //console.log("changing username") welcomeMsg_UserName = userData.nickname } text += '
'+welcomeMsg_UserName +welcomeMsg+'
'; text += '
'+ '
'; //
historyListArr = checkRecentlyPlayedItemVisibility(historyListArr) var default_max_historyListArr_length = 15; if(historyListArr.length < default_max_historyListArr_length) { default_max_historyListArr_length = historyListArr.length } //console.log(default_max_historyListArr_length) var j=0 for( j ;j'+ '
'+ '
'; text += '
'; } else if(show_quickPlay == 'radio'){ text += '
'; text += '
'; } else if(show_quickPlay == 'video'){ text += '
'; text += '
'; } text += '
'; text += ''; } } text += ''; $("#i0_recently_played").append(text); //console.log(text) // $("#i0_recently_played_landingGrid").append(text); //'#'+target+' .hot-album' $('#i0_recently_played .hot-album').slick({ dots: false, infinite: false, slidesToShow: 6, slidesToScroll: 6, lazyLoad: 'ondemand' }); } //landing grid view function getLandingGrid(data, type, target, moduleTitle, moduleDesc, color, descColor, moreLink, hasBackground){ var text = ''; var name = data.chiName; var moreImage = ''; var defaultImage = ''; if(lang == 'eng'){ name = data.engName; } var screenWidth = $(window).width(); var slickwidth = 1104; var slickLeft = 30; /* var bgHeight = 297; if(data.refType == 'VDO'){ bgHeight = 327; } */ if(screenWidth < 1440 && screenWidth > 995){ slickwidth = screenWidth*0.9-192; slickLeft = (screenWidth*0.2166+30)-(screenWidth*0.0666)-216; /* bgHeight = (slickwidth/6-(slickwidth-24)*0.02)+134; if(data.refType == 'VDO'){ bgHeight = (slickwidth/4-(slickwidth-24)*0.02)+134; } */ }else if(screenWidth <= 995){ slickwidth = 704; slickLeft = -37; /* bgHeight = 237.4; if(data.refType == 'VDO'){ bgHeight = 296.4; } */ } //$("#"+target+", #"+target+" .module-bg").css('height', bgHeight+'px'); text += '
'+moduleTitle+'
'+moduleDesc+'
'; //if(data.more == 'Y' && data.more != undefined && data.toRefType != "" && data.toRefType != undefined && data.toRefValue != "" && data.toRefValue != undefined ){ if(data.more == 'Y' && data.more != undefined ){ text += '
'+langJSON.general.more+' >
'; } text +='
'+ '
'; var module = getLandingModule(data); var isArtist = false; if(data.refType == 'ADO'){ moreImage = 'grid_audio-w-chi'; if(lang == 'eng'){ moreImage = 'grid_audio-w-eng'; } }else if(data.refType == 'VDO'){ moreImage = 'grid_video-w-chi'; if(lang == 'eng'){ moreImage = 'grid_video-w-eng'; } }else if(data.refType == 'PC' || data.refType == 'PCC'){ moreImage = 'grid_chart-w-chi'; if(lang == 'eng'){ moreImage = 'grid_chart-w-eng'; } }else if(data.refType == 'PAT'){ isArtist = true; moreImage = 'grid_artist-w-chi'; if(lang == 'eng'){ moreImage = 'grid_artist-w-eng'; } }else if(data.refType == 'PP' || data.refType == 'PPC' || data.refType == 'PPCG' || data.refType == 'PG'){ moreImage = 'grid_list-w-chi'; if(lang == 'eng'){ moreImage = 'grid_list-w-eng'; } }else if(data.refType == 'PCO'){ moreImage = 'grid_concert-w-chi'; if(lang == 'eng'){ moreImage = 'grid_concert-w-eng'; } }else if(data.refType == 'PAB' || data.refType == 'PABC'){ moreImage = 'grid_album-w-chi'; if(lang == 'eng'){ moreImage = 'grid_album-w-eng'; } }else{ moreImage = 'grid_audio-w-chi'; if(lang == 'eng'){ moreImage = 'grid_audio-w-eng'; } } if(hasBackground){ moreImage = moreImage.split('-')[0]+'-b-'+moreImage.split('-')[2]; } for (var i =0 ;i'+ // '
'+ '
'+ text += 'style="position: absolute; left: 0px; right: 0px; top: 0px; right: 0px; ">'+ ' '+title.replace(/\'/g, '; } text += '
'; var playImage = 'images/icon/play_over.png'; if(isArtist){ playImage = 'images/icon/radio_over.png'; } if(showPlayButton){ text += '
'+ '
'+ ''+ '
'+ '
'+ ''+ ''+ '
'+ '
'; } text += '
'+ '
'+safeTagsReplace((title == undefined)?'':title)+'
'+ ' '+((artist == undefined)?'':artist)+''+ '
'; if( (data.refType == 'VDO' || data.refType == 'PCO') && module[i].explicit != '0' && module[i].explicit != '' && module[i].explicit != 'N' && module[i].explicit != undefined){ text += '
'; } text += '
'; } if(data.more == 'Y' && data.more != undefined ){ text += '
'; } //text += '
Album Name2
Artist Name
'; text += ' '; $("#"+target).append(text); if(data.refType == 'VDO' || data.refType == 'PCO'){ $('#'+target+' .hot-album').slick({ dots: false, infinite: false, slidesToShow: 4, slidesToScroll: 4, lazyLoad: 'ondemand' }); }else{ $('#'+target+' .hot-album').slick({ dots: false, infinite: false, slidesToShow: 6, slidesToScroll: 6, lazyLoad: 'ondemand' }); } } function getLandingBlock(data, type, target, moduleTitle, moduleDesc, color, descColor, moreLink, hasBackground){ var text = ''; var name = data.chiName; if(lang == 'eng'){ name = data.engName; } var moreImage = ''; var defaultImage = ''; var screenWidth = $(window).width(); var slickwidth = 1104; var slickLeft = 30; //var bgHeight = 220; if(screenWidth < 1440 && screenWidth > 995){ slickwidth = screenWidth*0.9-192; slickLeft = (screenWidth*0.2166+30)-(screenWidth*0.0666)-216; //bgHeight = (slickwidth/6-(slickwidth-24)*0.02)*0.5+96; }else if(screenWidth <= 995){ slickwidth = 704; slickLeft = -37; //bgHeight = 152.7; } //$("#"+target+", #"+target+" .module-bg").css('height', bgHeight+'px'); text += '
'+moduleTitle+'
'+moduleDesc+'
'; if(data.more == 'Y' && data.more != undefined ){ text += '
'+langJSON.general.more+' >
'; } text += '
'+ '
'; var module = getLandingModule(data); if(data.refType == 'ADO'){ moreImage = 'block_audio-w-chi'; if(lang == 'eng'){ moreImage = 'block_audio-w-eng'; } }else if(data.refType == 'VDO'){ moreImage = 'block_video-w-chi'; if(lang == 'eng'){ moreImage = 'block_video-w-eng'; } }else if(data.refType == 'PC' || data.refType == 'PCC'){ moreImage = 'block_chart-w-chi'; if(lang == 'eng'){ moreImage = 'block_chart-w-eng'; } }else if(data.refType == 'PAT'){ isArtist = true; moreImage = 'block_artist-w-chi'; if(lang == 'eng'){ moreImage = 'block_artist-w-eng'; } }else if(data.refType == 'PP' || data.refType == 'PPC' || data.refType == 'PPCG' || data.refType == 'PG'){ moreImage = 'block_list-w-chi'; if(lang == 'eng'){ moreImage = 'block_list-w-eng'; } }else if(data.refType == 'PCO'){ moreImage = 'block_concert-w-chi'; if(lang == 'eng'){ moreImage = 'block_concert-w-eng'; } }else if(data.refType == 'PAB' || data.refType == 'PABC'){ moreImage = 'block_album-w-chi'; if(lang == 'eng'){ moreImage = 'block_album-w-eng'; } }else{ moreImage = 'block_audio-w-chi'; if(lang == 'eng'){ moreImage = 'block_audio-w-eng'; } } if(hasBackground){ moreImage = moreImage.split('-')[0]+'-b-'+moreImage.split('-')[2]; } for (var i =0 ;i'+ '
'; } if(data.more == 'Y' && data.more != undefined && data.toRefType != "" && data.toRefType != undefined && data.toRefValue != "" && data.toRefValue != undefined ){ text += '
'+ '
'+ '
'+ '
'+ '
'+ '
'; } text += '
'; $("#"+target).append(text); $('#'+target+' .hot-album').slick({ // lazyLoad: 'ondemand', dots: false, infinite: false, slidesToShow: 4, slidesToScroll: 4 }); } function setSlickWidth(){ $(window).resize(function() { if($("#landing").length > 0){ var screenWidth = $(window).width(); var bannerWidth = 1440; var bannerLeft = -342; var slickwidth = 1104; var itemMargin = 21.6; var slickLeft = 30; if(screenWidth < 1440 && screenWidth > 995){ bannerWidth = screenWidth; bannerLeft = -(screenWidth*0.2167)-30; slickwidth = screenWidth*0.9-192; itemMargin = (screenWidth*0.9-216)*0.02; slickLeft = (screenWidth*0.2166+30)-(screenWidth*0.0666)-216; }else if(screenWidth <= 995){ bannerWidth = 995; bannerLeft = -246; slickwidth = 704; itemMargin = 13.6; slickLeft = -37; } $("#landing .moduleBanners").css({"margin-left": bannerLeft+"px", "width": bannerWidth+"px"}); $("#landing .landing-list,#landing .moduleBlock,#landing .moduleGrid").css({"width": slickwidth+"px", "margin-left": (-slickLeft)+"px"}); //$(".moduleBlock").css({"width": slickwidth+"px", "margin-left": (-slickLeft)+"px"}); //$(".moduleGrid").css({"width": slickwidth+"px", "margin-left": (-slickLeft)+"px"}); $("#landing .landing-title").css({"margin-left": (-slickLeft)+"px"}); //$("#landing .moduleGrid .slick-slide,#landing .moduleBlock .slick-slide,#landing .landing-list .slick-slide").css('padding-right',itemMargin+'px'); $("#landing .moduleGrid .slick-slide,#landing .moduleBlock .slick-slide,#landing .landing-list .slick-slide").css('padding-right',(itemMargin-1)+'px'); /* $("#landing .moduleGrid .slick-slide,#landing .moduleBlock .slick-slide,#landing .landing-list .slick-slide").css({ 'padding-right': (itemMargin-1)+'px', 'padding-left': '1px' }); */ //$(".moduleBlock .slick-slide").css('padding-right',itemMargin+'px'); //$(".landing-list .slick-slide").css('padding-right',itemMargin+'px'); //$(".show-all").css('padding-right',itemMargin+'px'); } }); }