Authored by lore-w

girl mobile 详情页变脸、翻转、轮播图实现

Showing 34 changed files with 413 additions and 641 deletions
... ... @@ -2,9 +2,9 @@
var mobile;
require("./js/common");
require("./js/channel/detail320");
require("./js/channel/edit320");
require("./js/channel/feedback320");
require("./js/channel/detail");
require("./js/channel/edit");
require("./js/channel/feedback");
require("./js/channel/home");
require("./js/channel/magazine");
require("./js/channel/search");
... ...
/*
* @description: 详情页
* @author: lore-w
* @date: 2015-4-29
*/
var $ = require("jquery"),
tools = require('yoho-tools'),
swiper = require('swiper-mobile'),
jsonp = require('yoho-jsonp'),
mustache = require('mustache');
var flip = require("../plugin/flip"),
oShare = require("../plugin/share"),
slide = require("../plugin/photoslide");
require("../plugin/login");
require("../plugin/comment");
require("../plugin/content-paging");
exports.init = function () {
var page,
detailSwitch,
index,
url;
var commentBox;
// 变脸
slide.initSlide({
isMobile: true
});
// 翻转
function lifeFlip() {
var lifestyleFlip = $('.lifestyle-flip').size();
if (!!lifestyleFlip) {
flip.init();
}
}
lifeFlip();
$(".fashion").contentPaging({
pageContentWrap: ".fashion-text",
callback: function () {
lifeFlip();
}
});
//轮播图
var detailSwiper = new swiper('.detail-banner', {
mode: 'horizontal',
loop: true,
grabCursor: true,
slideElement: 'li',
onSlideChangeEnd: detailSwiperIndex
});
detailSwitch = $(".detail-switch");
page = !!detailSwiper.slides ? (detailSwiper.slides.length - 2) : 0;
detailSwitch.text(1 + '/' + page);
function detailSwiperIndex() {
setTimeout(function () {
index = detailSwiper.activeIndex;
if (index > page) {
index = 1;
} else if (index <= 0) {
index = page;
}
detailSwitch.text(index + '/' + page);
}, 0)
}
// 评论、相关推荐等
commentBox = $(".comments-box");
url =
'http://newgirls.test.yoho.cn/channel/detail/getbottom?id=' +
commentBox.attr("data-id") + '&type=' +
commentBox.attr("data-type") + '&c=' +
commentBox.attr("data-c") + '&twoc=' +
commentBox.attr("data-twoc");
jsonp({
url: url,
success: function (response) {
var data = response.data,
relatedPost = data.related,
prevnext = data.prevnext,
attitude = data.attitude,
commentnum = data.commentnum;
// 相关推荐
$('.recomment ul').append(mustache.render($('#related-tpl').html(), {
relatedPost: relatedPost
}));
//上一篇、下一篇
if (!!data.prevnext.prev.title) {
$('.detail-prev')
.show().find("a")
.attr("href", data.prevnext.prev.link)
.attr("title", data.prevnext.prev.title)
.attr("onclick", "prevOrNextClickEvent();");
}
if (!!data.prevnext.next.title) {
$('.detail-next')
.show().find("a")
.attr("href", data.prevnext.next.link)
.attr("title", data.prevnext.next.title)
.attr("onclick", "prevOrNextClickEvent();");
}
}
});
// 评论
$(".comments").on("click", function () {
var cidNum = commentBox.attr("cid");
if ($(".comment-textarea").size() > 0) {
if (commentBox.css("display") == "none") {
commentBox.show();
} else {
commentBox.hide();
}
} else {
commentBox.comment({
cid: cidNum,
commentPageUrl: '/comment/default/list',
publishUrl: '/comment/default/publish',
deleteUrl: '/comment/default/delete',
isMobile: true
});
}
});
//ajax参数
var param = {
id: commentBox.attr("cid"),
type: commentBox.attr("ctype"),
c: commentBox.attr("cc"),
twoc: commentBox.attr("ctwoc")
};
//态度
/*$(".stats-btn").find("li").removeClass("current");
setattitude(attitude.wowCount, attitude.zzzCount, attitude.wtfCount);
if (commentnum > 0) {
$(".comment-num").text(commentnum);
} else {
$(".comment-num").html('<img src="' + YohoConfig.resUrl + '/assets/images/comment-mobile.png">');
}
}
});*/
//态度设置
$(".stats-btn").on("click", "li", function () {
if ($(this).index() == 3) return;
var exType = $(this).index() + 1;
var isCancel = 0;
if ($(this).hasClass("current")) {
isCancel = 1;
}
//在请求开始之前先变色
if ($(this).hasClass("current")) {
$(this).removeClass('current');
} else {
$(".stats-btn").find("li").removeClass("current");
$(this).addClass('current');
}
var attitudeData = {id: param.id, exType: exType, isCancel: isCancel};
$.ajax({
type: 'POST',
url: YohoConfig.mainUrl + '/channel/detail/setattitude',
data: attitudeData,
dataType: 'json',
success: function (response) {
var attitude = response.data;
/*if(attitude.userWow>0){
$(".stats-btn .wow").addClass("current");
};
if(attitude.userWtf>0){
$(".stats-btn .wtf").addClass("current");
};
if(attitude.userZzz>0){
$(".stats-btn .zzz").addClass("current");
};*/
setattitude(attitude.wowCount, attitude.zzzCount, attitude.wtfCount);
}
});
});
function setattitude(wow, zzz, wtf) {
if (wow === 0) {
$(".stats-btn .wow").find("span").find("img").show();
$(".stats-btn .wow").find("span").find("i").hide();
} else {
$(".stats-btn .wow").find("span").find("i").text(wow).show();
$(".stats-btn .wow").find("span").find("img").hide();
}
if (zzz === 0) {
$(".stats-btn .zzz").find("span").find("img").show();
$(".stats-btn .zzz").find("span").find("i").hide();
} else {
$(".stats-btn .zzz").find("span").find("i").text(zzz).show();
$(".stats-btn .zzz").find("span").find("img").hide();
}
if (wtf === 0) {
$(".stats-btn .wtf").find("span").find("img").show();
$(".stats-btn .wtf").find("span").find("i").hide();
} else {
$(".stats-btn .wtf").find("span").find("i").text(wtf).show();
$(".stats-btn .wtf").find("span").find("img").hide();
}
}
exports.updateLogin = function () {
$(".comments-box").login("updateLoginState");
$(".comments-box").comment("publishComment");
};
$(".side-bar-header").login();
$(".side-bar-header").on("click", function () {
$(this).login("loginBoxAnimate");
});
//手机版弹出登录框
/*$(".side-bar-header").on("click",function(){
if($(this).hasClass("login-success")) return;
$(".comments-box").comment("loginBoxAnimate");
})*/
//$(".comments-box").comment("initLoginState");
//share
var shareUrl = $("#share").attr("data-link");
oShare.init({
shareUrl: shareUrl,
img: $("#share").attr("cover"),
sinaText: '【Yoho!Boys】' + $(".share-h2").text() + '\r\n' + $(".share-h3").text(),
fbTextFunction: function () {
return {
des: '【Yoho!Boys】' + $(".share-h2").text() + '\r\n' + $(".share-h3").text() + '#YohoBoy',
name: '【Yoho!Boys】' + $(".share-h2").text() + '\r\n' + $(".share-h3").text() + '#YohoBoy',
caption: '【Yoho!Boys】' + $(".share-h2").text() + '\r\n' + $(".share-h3").text() + '#YohoBoy',
url: location.href
}
},
tweetText: '【Yoho!Boys】' + $(".share-h2").text() + '\r\n' + $(".share-h3").text() + '@YOHO潮流志',
qqText: '【Yoho!Boys】' + $(".share-h2").text() + '\r\n' + $(".share-h3").text() + '(来自Yoho!Boys)'
});
//hr分页
(function () {
// iphone上面的视频处理
var UserAgent = navigator.userAgent.toLowerCase();
var IsIphoneOs = UserAgent.match(/iphone os/i) == "iphone os";
var videoWrap = $('.fashion-text');
if (IsIphoneOs) {
// 内容中视频播放器替换为H5的VIDEO标签
if (videoWrap.find("object").length > 0) {
var defaultCover = videoWrap.attr("cover-url");
var playHref = "", videoUrl = "", videoCover = "", videoHtml = "";
videoWrap.find("object").each(function () {
playHref = $(this).find('embed').attr('src');
videoUrl = tools.request('url', playHref);
videoCover = tools.request('coverpic', playHref);
if (videoCover === "") {
videoCover = defaultCover;
}
videoCover = videoCover.replace(/%3A/g, ':').replace(/%2F/g, '/');
videoHtml = '<video controls="controls" preload="auto" width="290px" height="163px" poster="' + videoCover + '">' +
'<source src="' + videoUrl + '" type="video/mp4">' +
'</video>';
$(this).replaceWith(videoHtml);
});
}
}
})();
};
/**
* 点击关联关系区的事件
*/
function relatedClickEvent() {
_hmt.push(['_trackEvent', '2.0 related', '2.0 post mobile', '2.0 related mobile']);
}
/**
* 点击上一页/下一页的事件
*/
function prevOrNextClickEvent() {
_hmt.push(['_trackEvent', '2.0 prev or next', '2.0 prev or next mobile', '2.0 prev or next mobile']);
}
... ...
/*
* @description: 详情页
* @author: chenglong.wang@yoho.cn
* @date: 2015/1/13
*/
var $ = require("jquery");
var tools = require('yoho-tools');
var swiper = require('swiper-mobile');
var oShare = require("../plugin/share");
var flip = require("../plugin/flip");
var slide = require("../plugin/photoslide");
require("../plugin/login");
require("../plugin/comment");
require("../plugin/content-paging");
exports.init = function() {
//轮播图
var fashionSwiper = new swiper('.fashion-banner',{
mode:'horizontal',
loop: true,
grabCursor: true,
paginationClickable: true,
slideElement: 'li',
onSlideChangeEnd: fashionSwiperIndex
});
var fashionSwitch = $(".fashion-switch");
var page;
if (!!fashionSwiper.slides) {
page = fashionSwiper.slides.length-2;
}
fashionSwitch.text(1+'/'+page);
function fashionSwiperIndex () {
var index = fashionSwiper.activeIndex;
//index = index > page ? 1 : index;
if (index > page) {
index = 1;
}else if (index <= 0) {
index = page;
}
fashionSwitch.text(index+'/'+page);
$(".relazy").lazyload({threshold: 100});
}
//变脸效果
slide.initSlide({
isMobile: true
});
var commentBox =$(".comments-box");
$(".comments").on("click",function(){
var cidNum = commentBox.attr("cid");
if($(".comment-textarea").size()>0){
if(commentBox.css("display") == "none"){
commentBox.show();
}else{
commentBox.hide();
}
}else{
commentBox.comment({
cid:cidNum,
commentPageUrl:'/comment/default/list',
publishUrl:'/comment/default/publish',
deleteUrl:'/comment/default/delete',
isMobile:true
});
}
});
//ajax参数
var param = {
id:commentBox.attr("cid"),
type:commentBox.attr("ctype"),
c:commentBox.attr("cc"),
twoc:commentBox.attr("ctwoc")
};
//底部数据的获取
$.ajax({
type:'GET',
url:YohoConfig.mainUrl+'/channel/detail/getbottom?id='+param.id+'&type='+param.type+'&c='+param.c+'&twoc='+param.twoc,
success:function(response){
var data = response.data;
var relatedPost = data.related,
prevnext = data.prevnext,
attitude = data.attitude,
commentnum = data.commentnum;
//新品播报
var relatedPostItem = '';
for(var i=0;i<3;i++){
if(relatedPost[i].isVideo === true){
var video = '<li>'+
'<a href="'+relatedPost[i].link+'" target="_blank" onclick="relatedClickEvent();">'+
'<div class="content-pic">'+
'<img src="'+relatedPost[i].cover+'" alt="" />'+
'<span class="play-icon"></span>'+
'</div>'+
'<div class="content-text">'+
'<h2>'+relatedPost[i].title+'</h2>'+
'<h3>'+relatedPost[i].subtitle+'</h3>'+
'</div>'+
'</a>'+
'</li>';
relatedPostItem += video;
}else{
var img = '<li>'+
'<a href="'+relatedPost[i].link+'" target="_blank" onclick="relatedClickEvent();">'+
'<div class="content-pic">'+
'<img src="'+relatedPost[i].cover+'" alt="" />'+
'</div>'+
'<div class="content-text">'+
'<h2>'+relatedPost[i].title+'</h2>'+
'<h3>'+relatedPost[i].subtitle+'</h3>'+
'</div>'+
'</a>'+
'</li>';
relatedPostItem += img;
}
}
$(".recomment ul").append($(relatedPostItem));
//上一篇下一篇
var pagePrev = $('.detail-prev');
var pageNext = $('.detail-next');
if(prevnext.prev.title){
pagePrev.show();
pagePrev.find("a").attr("href",prevnext.prev.link)
.attr("title",prevnext.prev.title).attr("onclick","prevOrNextClickEvent();");
}
if(prevnext.next.title){
pageNext.show();
pageNext.find("a").attr("href",prevnext.next.link)
.attr("title",prevnext.next.title).attr("onclick","prevOrNextClickEvent();");
}
//态度
$(".stats-btn").find("li").removeClass("current");
setattitude(attitude.wowCount,attitude.zzzCount,attitude.wtfCount);
if(commentnum>0){
$(".comment-num").text(commentnum);
}else{
$(".comment-num").html('<img src="'+YohoConfig.resUrl+'/assets/images/comment-mobile.png">');
}
}
});
//态度设置
$(".stats-btn").on("click","li",function(){
if($(this).index() == 3) return;
var exType = $(this).index()+1;
var isCancel = 0;
if($(this).hasClass("current")){
isCancel = 1;
}
//在请求开始之前先变色
if($(this).hasClass("current")){
$(this).removeClass('current');
}else{
$(".stats-btn").find("li").removeClass("current");
$(this).addClass('current');
}
var attitudeData = {id:param.id,exType:exType,isCancel:isCancel};
$.ajax({
type:'POST',
url:YohoConfig.mainUrl+'/channel/detail/setattitude',
data:attitudeData,
dataType:'json',
success:function(response){
var attitude = response.data;
/*if(attitude.userWow>0){
$(".stats-btn .wow").addClass("current");
};
if(attitude.userWtf>0){
$(".stats-btn .wtf").addClass("current");
};
if(attitude.userZzz>0){
$(".stats-btn .zzz").addClass("current");
};*/
setattitude(attitude.wowCount,attitude.zzzCount,attitude.wtfCount);
}
});
});
function setattitude(wow,zzz,wtf){
if(wow ===0){
$(".stats-btn .wow").find("span").find("img").show();
$(".stats-btn .wow").find("span").find("i").hide();
}else{
$(".stats-btn .wow").find("span").find("i").text(wow).show();
$(".stats-btn .wow").find("span").find("img").hide();
}
if(zzz ===0){
$(".stats-btn .zzz").find("span").find("img").show();
$(".stats-btn .zzz").find("span").find("i").hide();
}else{
$(".stats-btn .zzz").find("span").find("i").text(zzz).show();
$(".stats-btn .zzz").find("span").find("img").hide();
}
if(wtf ===0){
$(".stats-btn .wtf").find("span").find("img").show();
$(".stats-btn .wtf").find("span").find("i").hide();
}else{
$(".stats-btn .wtf").find("span").find("i").text(wtf).show();
$(".stats-btn .wtf").find("span").find("img").hide();
}
}
exports.updateLogin = function(){
$(".comments-box").login("updateLoginState");
$(".comments-box").comment("publishComment");
};
$(".side-bar-header").login();
$(".side-bar-header").on("click",function(){
$(this).login("loginBoxAnimate");
});
//手机版弹出登录框
/*$(".side-bar-header").on("click",function(){
if($(this).hasClass("login-success")) return;
$(".comments-box").comment("loginBoxAnimate");
})*/
//$(".comments-box").comment("initLoginState");
//share
var shareUrl = $("#share").attr("data-link");
oShare.init({
shareUrl:shareUrl,
img:$("#share").attr("cover"),
sinaText:'【Yoho!Boys】'+$(".share-h2").text()+'\r\n'+$(".share-h3").text(),
fbTextFunction:function(){
return {
des:'【Yoho!Boys】'+$(".share-h2").text()+'\r\n'+$(".share-h3").text()+'#YohoBoy',
name:'【Yoho!Boys】'+$(".share-h2").text()+'\r\n'+$(".share-h3").text()+'#YohoBoy',
caption:'【Yoho!Boys】'+$(".share-h2").text()+'\r\n'+$(".share-h3").text()+'#YohoBoy',
url:location.href
}
},
tweetText:'【Yoho!Boys】'+$(".share-h2").text()+'\r\n'+$(".share-h3").text()+'@YOHO潮流志',
qqText:'【Yoho!Boys】'+$(".share-h2").text()+'\r\n'+$(".share-h3").text()+'(来自Yoho!Boys)'
});
//hr分页
(function () {
// iphone上面的视频处理
var UserAgent = navigator.userAgent.toLowerCase();
var IsIphoneOs = UserAgent.match(/iphone os/i) == "iphone os";
var videoWrap = $('.fashion-text');
if (IsIphoneOs) {
// 内容中视频播放器替换为H5的VIDEO标签
if (videoWrap.find("object").length > 0) {
var defaultCover = videoWrap.attr("cover-url");
var playHref = "", videoUrl = "", videoCover = "", videoHtml = "";
videoWrap.find("object").each(function() {
playHref = $(this).find('embed').attr('src');
videoUrl = tools.request('url', playHref);
videoCover = tools.request('coverpic', playHref);
if (videoCover === "") {
videoCover = defaultCover;
}
videoCover = videoCover.replace(/%3A/g, ':').replace(/%2F/g, '/');
videoHtml = '<video controls="controls" preload="auto" width="290px" height="163px" poster="'+videoCover+'">'+
'<source src="' + videoUrl + '" type="video/mp4">'+
'</video>';
$(this).replaceWith(videoHtml);
});
}
}
})();
$(".fashion").contentPaging({
pageContentWrap:".fashion-text",
callback:function () {
lifeFlip();
}
});
//翻转
function lifeFlip () {
var lifestyleFlip = $('.lifestyle-flip').size();
if (!!lifestyleFlip) {
flip.init();
}
}
lifeFlip();
};
/**
* 点击关联关系区的事件
*/
function relatedClickEvent()
{
_hmt.push(['_trackEvent', '2.0 related', '2.0 post mobile', '2.0 related mobile']);
}
/**
* 点击上一页/下一页的事件
*/
function prevOrNextClickEvent()
{
_hmt.push(['_trackEvent', '2.0 prev or next', '2.0 prev or next mobile', '2.0 prev or next mobile']);
}
var $ = require("jquery");
require("../plugin/comment");
require("../plugin/login");
var mulLine = require('../plugin/mlellipsis');
/*
* @description: common js
* @author: lore-w
* @date: 2015-4-23
*/
var commentBox = $('.comment-area');
exports.init = function() {
var cidNum = $(".has-comment").attr("cid");
$(".comment_button").on("click",function(){
if(commentBox.attr('isshow') === 'true'){
commentBox.attr('isshow','false').css('display','none');
}else{
commentBox.comment({cid:cidNum,isEdit:true,isMobile:true}).css('display','block');
commentBox.attr('isshow','true');
var $ = require("jquery"),
mulLine = require('../plugin/mlellipsis');
require("../plugin/login");
require("../plugin/comment");
exports.init = function () {
var cidNum = $(".has-comment").attr("cid"),
id = '';
var commentBox = $('.comment-area'),
commentBtn = $(".comment_button");
commentBtn.on("click", function () {
if (commentBox.attr('isshow') === 'true') {
commentBox.attr('isshow', 'false').css('display', 'none');
} else {
commentBox.comment({cid: cidNum, isEdit: true, isMobile: true}).css('display', 'block');
commentBox.attr('isshow', 'true');
}
});
var id = {id:cidNum};
id = {id: cidNum};
$.ajax({
type:'GET',
url:YohoConfig.mainUrl+'/writer/default/comment',
type: 'GET',
url: YohoConfig.mainUrl + '/writer/default/comment',
data: id,
dataType:'json',
success:function(response) {
dataType: 'json',
success: function (response) {
var data = response.data.total;
if (data) {
$('.comment_button b').text(data);
}else{
} else {
$('.comment_button b').text('留言');
}
}
});
//截字
//截字
mulLine.init();
var LineNum;
var items = $(".edit-intrduce p");
var index = 0;
(function () {
LineNum=items.getTextLineNumber("detail");
if (LineNum>2) {
items.mlellipsis(2,"detail");
LineNum = items.getTextLineNumber("detail");
if (LineNum > 2) {
items.mlellipsis(2, "detail");
var res = items.text();
var resLenght = res.length;
res = res.substring(0,resLenght-6)+"...";
res = res.substring(0, resLenght - 6) + "...";
items.text(res);
}
})();
$('.line-btn').click(function () {
index++;
if (index % 2 != 0) {
items.mlellipsis(LineNum,"detail");
items.mlellipsis(LineNum, "detail");
$(this).addClass('edit-active');
}else{
items.mlellipsis(2,"detail");
} else {
items.mlellipsis(2, "detail");
$(this).removeClass('edit-active');
}
var res = items.text();
var resLenght = res.length;
res = res.substring(0,resLenght-6)+"...";
res = res.substring(0, resLenght - 6) + "...";
items.text(res);
});
};
//第三方登陆
exports.updateLogin = function(){
exports.updateLogin = function () {
commentBox.login("updateLoginState");
commentBox.comment("publishComment");
};
\ No newline at end of file
... ...
... ... @@ -9,6 +9,7 @@ var $ = require('jquery'),
exports.init = function () {
// 小电视
var videoSwiper = new swiper('.video.swiper-container', {
slidesPerView: 'auto',
grabCursor: true,
... ...
... ... @@ -5,7 +5,8 @@
*/
var $ = require('jquery'),
swiper = require('swiper-mobile');
swiper = require('swiper-mobile'),
jsonp = require('yoho-jsonp');
var oShare = require("../plugin/share");
... ... @@ -13,12 +14,9 @@ exports.init = function () {
var magazineSwiper,
buySwiper,
zineSwiper,
currentPageNumber = 1,
url = '',
totalLength,
currentIndex,
share = $("#share"),
zineSwiper;
var share = $("#share"),
magazineMore = $(".magazine-more");
// magazine banner
... ... @@ -28,7 +26,9 @@ exports.init = function () {
grabCursor: true,
paginationClickable: true,
autoplay: 5000,
slideElement: 'li'
slideElement: 'li',
lazyLoading: true,
lazyLoadingInPrevNext: true
});
// 立即购买下方的slide
... ... @@ -37,96 +37,31 @@ exports.init = function () {
grabCursor: true,
slideElement: 'li',
wrapperClass: "buy-wrapper",
onSlideChangeEnd: fallSwiperItems_buy
});
// zine slide
zineSwiper = new swiper('#zine-slide', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
wrapperClass: 'zine-wrapper'
//onSlideChangeEnd: fallSwiperItems_rule
lazyLoading: true,
watchSlidesVisibility: true
});
function fallSwiperItems_buy() {
var currentSlide = arguments[0];
_fallSwiperItems(currentSlide, 'buy');
}
function fallSwiperItems_rule() {
var currentSlide = arguments[0];
_fallSwiperItems(currentSlide, 'rule');
}
function _fallSwiperItems(currentSlide, type) {
if (type === 'buy') {
url = '/channel/magazine/page?type=1&p=';
} else if (type == 'zine') {
url = '/channel/magazine/page?type=2&p=';
} else {
url = '/channel/magazine/rules?p=';
}
totalLength = $(currentSlide.container).find(".swiper-slide").length;
currentIndex = currentSlide.activeIndex;
if (totalLength - currentIndex <= 6) {
$.ajax({
url: url + (currentPageNumber++),
cache: false,
success: function (data) {
var i = 0,
oLi,
LastSlide;
for (i = 0; i < data.data.length; i++) {
var cItem = data.data[i];
var newAppend = currentSlide.createSlide("<a><img src='" + cItem.cover + "' dynamic='" + cItem.dynamic + "'/></a><time>" + cItem.title + "</time>");
newAppend.append();
}
oLi = $(currentSlide.container).find(".swiper-slide");
LastSlide = currentSlide.getLastSlide();
oLi.css({'width': '131px'});
$(LastSlide).css({'width': '121px'});
currentSlide.reInit();
}
});
}
}
//e-zine
$.ajax({
type: 'GET',
url: '/channel/magazine/ezine',
jsonp({
url: 'http://newgirls.test.yoho.cn/channel/magazine/ezine',
success: function (response) {
var data = response.data;
var len = data.length;
var item = '';
var data = response.data,
len = data.length,
item = '';
for (var i = 0; i < len; i++) {
if (data[i].magazineType == 2) {
item += '<li class="swiper-slide"><a class="magazine-special" href="javascript:;" title="' + data[i].releaseDate + '"><img src="' + data[i].cover + '" alt="" /></a><time>' + data[i].releaseDate + '</time></li>';
item += '<li class="swiper-slide"><a class="magazine-special" href="javascript:;" title="' + data[i].releaseDate + '"><img class="swiper-lazy" data-src="' + data[i].cover + '" alt="" /><div class="swiper-lazy-preloader"></div></a><time>' + data[i].releaseDate + '</time></li>';
} else {
item += '<li class="swiper-slide"><a href="javascript:;" title="' + data[i].releaseDate + '"><img src="' + data[i].cover + '" alt="" /></a><time>' + data[i].releaseDate + '</time></li>';
item += '<li class="swiper-slide"><a href="javascript:;" title="' + data[i].releaseDate + '"><img class="swiper-lazy" data-src="' + data[i].cover + '" alt="" /><div class="swiper-lazy-preloader"></div></a><time>' + data[i].releaseDate + '</time></li>';
}
}
$(".zine-wrapper").html(item);
var zineSlide = new swiper('.zine-slide', {
wrapperClass: "zine-wrapper",
paginationClickable: true,
zineSwiper = new swiper('#zine-slide', {
slidesPerView: 'auto',
slideElement: 'li'
grabCursor: true,
slideElement: 'li',
wrapperClass: "zine-wrapper",
lazyLoading: true,
watchSlidesVisibility: true
});
}
});
... ...
... ... @@ -62,7 +62,9 @@ exports.init = function () {
grabCursor: true,
paginationClickable: true,
autoplay: 5000,
slideElement: 'li'
slideElement: 'li',
lazyLoading: true,
lazyLoadingInPrevNext: true
});
// download app
... ...
... ... @@ -13,6 +13,7 @@ window.onresize = function() {
}
exports.initSlide = function(info) {
tmpInfo = info;
var defaults = {
isMobile: false,
... ...
... ... @@ -37,4 +37,6 @@
//插件
@import "partial/plugin/swiper";
\ No newline at end of file
@import "partial/plugin/flip";
@import "partial/plugin/swiper";
@import "partial/plugin/photoslider";
... ...
@charset "utf-8";
/*
* @description: header css
* @author: chenglong.wang@yoho.cn
* @date: 2015/4/22
* @description: detail css
* @author: lore-w
* @date: 2015-4-22
*/
.detail {
... ... @@ -59,7 +59,7 @@
display: inline-block;
}
.detail-switch {
//@include retina-sprite($icons,page-opacity);
@include retina-sprite($icons,page-opacity);
font-size: 1.4rem;
color: #fff;
font-weight: bold;
... ... @@ -68,6 +68,7 @@
position: absolute;
right: 5px;
bottom: 10px;
z-index: 100;
}
}
.detail-text {
... ... @@ -188,23 +189,27 @@
position: relative;
}
.detail-prev {
display: none;
float: left;
&:before {
content: '';
@include retina-sprite($icons, comment-prev, false, true);
left: 0;
}
float: left;
a {
margin-left: 20px;
}
}
.detail-next {
display: none;
float: right;
&:after {
content: '';
@include retina-sprite($icons, comment-next, false, true);
right: 0;
}
float: right;
a {
margin-right: 20px;
}
... ...
... ... @@ -39,7 +39,7 @@
.home-content {
margin: 20px 15px 0 15px;
@each $channel in fashion, lifestyle, video {
@each $channel in default, fashion, beauty, sport, lifestyle, magazine, video {
.channel-#{$channel} {
.img-link {
position: relative;
... ...
... ... @@ -208,5 +208,4 @@
margin: 9px 0 0 23px;
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -14,6 +14,10 @@ a {
@include unstyled-link();
}
img {
border: none;
}
html, body {
color: $font-color;
font-size: $font-size;
... ...
... ... @@ -6,6 +6,7 @@
.sub-tag {
height: 25px;
min-width: 220px;
line-height: 25px;
padding: 0 18px;
position: absolute;
... ...
/*
* @description: index css
* @author: chenglong.wang@yoho.cn
* @date: 2015/4/24
* @description: banner css
* @author: lore-w
* @date: 2015-4-24
*/
//banner
... ... @@ -40,7 +40,7 @@
}
}
@each $channel in home, fashion, beauty, sport, lifestyle, video {
@each $channel in default, fashion, beauty, sport, lifestyle, video {
##{$channel} {
.banner {
.swiper-pagination-bullet {
... ...
... ... @@ -77,7 +77,7 @@
}
}
@each $channel, $color in (home, #000),
@each $channel, $color in (default, #000),
(fashion, #9b90ff),
(beauty, #ffcaca),
(sport, #84e3ca),
... ...
... ... @@ -31,7 +31,7 @@
}
}
@each $nav-item in home, fashion, beauty, sport, lifestyle, magazine, video {
@each $nav-item in default, fashion, beauty, sport, lifestyle, magazine, video {
.nav-#{$nav-item} a {
@include retina-sprite($nav, #{$nav-item}-black);
margin: 10px 12px 0 10px;
... ... @@ -40,7 +40,7 @@
}
@each $channel, $color, $val in (home, #c3e2ce, 1),
@each $channel, $color, $val in (default, #c3e2ce, 1),
(fashion, #9b90ff, 2),
(beauty, #ffcaca, 3),
(sport, #84e3ca, 4),
... ... @@ -55,6 +55,7 @@
li:nth-of-type(#{$val}) {
a {
@include retina-sprite($nav, #{$channel}-nav);
margin: 10px 12px 0 10px;
}
/*&:after {
... ... @@ -70,4 +71,4 @@
}
}
}
}
\ No newline at end of file
}
... ...
<<<<<<< HEAD
/*
* Swiper 2.7.5
* Mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/sliders/swiper/
*
* Copyright 2010-2015, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under GPL & MIT
*
* Released on: January 4, 2015
*/
/* ===============================================================
Basic Swiper Styles
================================================================*/
.swiper-container {
margin:0 auto;
position:relative;
overflow:hidden;
-webkit-backface-visibility:hidden;
-moz-backface-visibility:hidden;
-ms-backface-visibility:hidden;
-o-backface-visibility:hidden;
backface-visibility:hidden;
/* Fix of Webkit flickering */
z-index:1;
}
.swiper-wrapper {
position:relative;
width:100%;
-webkit-transition-property:-webkit-transform, left, top;
-webkit-transition-duration:0s;
-webkit-transform:translate3d(0px,0,0);
-webkit-transition-timing-function:ease;
-moz-transition-property:-moz-transform, left, top;
-moz-transition-duration:0s;
-moz-transform:translate3d(0px,0,0);
-moz-transition-timing-function:ease;
-o-transition-property:-o-transform, left, top;
-o-transition-duration:0s;
-o-transform:translate3d(0px,0,0);
-o-transition-timing-function:ease;
-o-transform:translate(0px,0px);
-ms-transition-property:-ms-transform, left, top;
-ms-transition-duration:0s;
-ms-transform:translate3d(0px,0,0);
-ms-transition-timing-function:ease;
transition-property:transform, left, top;
transition-duration:0s;
transform:translate3d(0px,0,0);
transition-timing-function:ease;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.swiper-free-mode > .swiper-wrapper {
-webkit-transition-timing-function: ease-out;
-moz-transition-timing-function: ease-out;
-ms-transition-timing-function: ease-out;
-o-transition-timing-function: ease-out;
transition-timing-function: ease-out;
margin: 0 auto;
}
.swiper-slide {
float: left;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
/* IE10 Windows Phone 8 Fixes */
.swiper-wp8-horizontal {
-ms-touch-action: pan-y;
}
.swiper-wp8-vertical {
-ms-touch-action: pan-x;
}
/* ===============================================================
Your custom styles, here you need to specify container's and slide's
sizes, pagination, etc.
=======
/*
* Swiper 2.7.5
* Mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/sliders/swiper/
*
* Copyright 2010-2015, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under GPL & MIT
*
* Released on: January 4, 2015
*/
/* ===============================================================
Basic Swiper Styles
================================================================*/
.swiper-container {
margin:0 auto;
position:relative;
overflow:hidden;
-webkit-backface-visibility:hidden;
-moz-backface-visibility:hidden;
-ms-backface-visibility:hidden;
-o-backface-visibility:hidden;
backface-visibility:hidden;
/* Fix of Webkit flickering */
z-index:1;
}
.swiper-wrapper {
position:relative;
width:100%;
-webkit-transition-property:-webkit-transform, left, top;
-webkit-transition-duration:0s;
-webkit-transform:translate3d(0px,0,0);
-webkit-transition-timing-function:ease;
-moz-transition-property:-moz-transform, left, top;
-moz-transition-duration:0s;
-moz-transform:translate3d(0px,0,0);
-moz-transition-timing-function:ease;
-o-transition-property:-o-transform, left, top;
-o-transition-duration:0s;
-o-transform:translate3d(0px,0,0);
-o-transition-timing-function:ease;
-o-transform:translate(0px,0px);
-ms-transition-property:-ms-transform, left, top;
-ms-transition-duration:0s;
-ms-transform:translate3d(0px,0,0);
-ms-transition-timing-function:ease;
transition-property:transform, left, top;
transition-duration:0s;
transform:translate3d(0px,0,0);
transition-timing-function:ease;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.swiper-free-mode > .swiper-wrapper {
-webkit-transition-timing-function: ease-out;
-moz-transition-timing-function: ease-out;
-ms-transition-timing-function: ease-out;
-o-transition-timing-function: ease-out;
transition-timing-function: ease-out;
margin: 0 auto;
}
.swiper-slide {
float: left;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
/* IE10 Windows Phone 8 Fixes */
.swiper-wp8-horizontal {
-ms-touch-action: pan-y;
}
.swiper-wp8-vertical {
-ms-touch-action: pan-x;
}
/* ===============================================================
Your custom styles, here you need to specify container's and slide's
sizes, pagination, etc.
>>>>>>> ww_develop
================================================================*/
\ No newline at end of file
... ... @@ -41,4 +41,9 @@
}
}
}
#mobile-wrap .photoslider_moused_over img {
overflow: hidden;
display: block;
}
\ No newline at end of file
... ...