(function(){ SetDirviceData() var infoID = (JSON.parse(localStorage.getItem("info"))).id; var ListArr = JSON.parse(localStorage.getItem(list)); ListArr.forEach(function(val,index) { if(val.id == infoID) { $(".like").removeClass("icon-star-outline").addClass("icon-star") } }) var infoData = JSON.parse(localStorage.getItem("info")) $(".info-top").css({ background: `url("${infoData.albums[0]}") center /cover no-repeat` }) document.title = infoData.title $(".social-share").attr({ 'data-description': infoData.imtro }) $(".info-title h2").text(`${infoData.title}`) $(".info-title p").text(`${infoData.imtro}`) $(".zhu p").text(`${infoData.ingredients}`) $(".fu p").text(`${infoData.burden}`) infoData.steps.forEach(function(val,index) { $(".info-step").append(`

${infoData.title} 步骤 ${index+1}

${val.step}

`) }); var $config = { url: location.href, title: infoData.title, description: infoData.imtro, image: infoData.albums[0], sites: ['qzone', 'qq', 'weibo','wechat', 'douban'], wechatQrcodeTitle : "微信扫一扫:分享", wechatQrcodeHelper : '

微信里点“发现”,扫一下

二维码便可将本文分享至朋友圈。

', }; $(".icon-share2").click(function(){ $(".share").animate({ bottom: "0" }, 200 ); }); $(".g-view").click(function(){ $(".share").animate({ bottom: "-60px" }, 200 ); }); $('.icon-star-outline').on("click",function() { var data = JSON.parse(localStorage.getItem(list)); data.push(JSON.parse(localStorage.getItem("info"))) localStorage.setItem(list,JSON.stringify(data)) YDUI.dialog.toast('已收藏成功', 'success', 1000); $(".like").removeClass("icon-star-outline").addClass("icon-star") }) })()