index_match.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. let userAgent;
  2. let isSafari = false;
  3. let browserName;
  4. window.onload = function(){
  5. // if(screen.width < 900){
  6. // window.location.href = "https://m3.hhh.com.tw/";
  7. // }
  8. userAgent = navigator.userAgent;
  9. detectBrowser(userAgent);
  10. detectDirection ();
  11. let result;
  12. let matchData;
  13. $.ajax({
  14. method: "GET",
  15. url: "./json/realtime.json",
  16. dataType: "json",
  17. }).done(function (msg) {
  18. // result = [...msg];
  19. // renderSec00(result);
  20. // renderSec02(result);
  21. // renderSec05(result);
  22. // renderSec06(result);
  23. // renderSec07(result);
  24. // renderSec08(result);
  25. // renderSec09(result);
  26. // renderSec10(result);
  27. // //renderSec11(result);
  28. // renderVideo(result);
  29. // renderTrending(result);
  30. });
  31. $.ajax({
  32. method: "GET",
  33. url: "./json/match.json",
  34. dataType: "json",
  35. }).done(function (msg) {
  36. matchData = [...msg];
  37. renderMatch(matchData);
  38. });
  39. }
  40. function renderMatch(matchData){
  41. let str = '';
  42. for(let i = 0; i < matchData.length; i++){
  43. str += `<div class="row align-items-center py-4 pb-5 justify-content-center text-center container__row" style="border-bottom: 1px solid #B2B2B2;">
  44. <div class="col-12 mb-4">
  45. <div class="sec-result__imgfr mx-auto" style="background-image: url('${matchData[i].WorkImg}');"
  46. onclick="window.open('${matchData[i].DesignerLink}');"></div>
  47. </div>
  48. <div class="row">
  49. <div class="col-6">
  50. <div class="sec-result__designer mx-auto mb-4" style="background-image: url('${matchData[i].DesignerImg}');">
  51. </div>
  52. <button class="btn-match">我有興趣</button>
  53. </div>
  54. <div class="col-6">
  55. <div class="text-start mx-auto">
  56. <p>${matchData[i].Name} 設計師</p>
  57. <p class="mb-2">${matchData[i].CompanyName}</p>
  58. <p>擅長風格 ${matchData[i].Style}</p>
  59. <p>接案坪數 ${matchData[i].Square}</p>
  60. <p class="mb-2">接案地區 ${matchData[i].Area}</p>
  61. <span class="sec-result__consulting"><strong class="sec-result__num">${matchData[i].Consulting}</strong> 人正在諮詢</span>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. `
  67. }
  68. $('.container__match').html(str);
  69. }
  70. $(document).on("click", ".btn-match", function (event) {
  71. Swal.fire({
  72. icon: 'success',
  73. text: '我們已收到您的訊息,將有幸福經紀人與您聯繫',
  74. confirmButtonText: '關閉',
  75. })
  76. });
  77. function detectDirection () {
  78. let height = (window.screen.width * 5) / 12;
  79. console.log(height);
  80. $('.sec-02 .slide-item').css('height', `${height}px`);
  81. }
  82. function detectBrowser(agent){
  83. if(userAgent.match(/chrome|chromium|crios/i)){
  84. browserName = "chrome";
  85. }else if(userAgent.match(/firefox|fxios/i)){
  86. browserName = "firefox";
  87. } else if(userAgent.match(/safari/i)){
  88. browserName = "safari";
  89. }else if(userAgent.match(/opr\//i)){
  90. browserName = "opera";
  91. } else if(userAgent.match(/edg/i)){
  92. browserName = "edge";
  93. }else{
  94. browserName="No browser detection";
  95. }
  96. if(browserName === 'safari'){
  97. isSafari = true;
  98. }
  99. console.log(isSafari);
  100. }
  101. function renderSec00(data) {
  102. let temp = data[0]['data'];
  103. renderBannerStr('sec-00__slider', temp);
  104. $(".sec-00__slider").slick({
  105. dots: false,
  106. speed: 800,
  107. autoplay: true,
  108. autoplaySpeed: 5000,
  109. arrows: true,
  110. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>',
  111. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>'
  112. });
  113. }
  114. function renderSec02(data) {
  115. let temp = data[1]['data'];
  116. renderBannerStr('sec-02__slider', temp);
  117. $(".sec-02__slider").slick({
  118. dots: false,
  119. autoplay: true,
  120. arrows: true,
  121. fade: true,
  122. autoplaySpeed: 4000,
  123. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 33px;color: white;transform: translateY(-10px);"></i></button>',
  124. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 33px;color: white;transform: translateY(-10px);"></i></button>'
  125. });
  126. }
  127. function renderBannerStr(sec, data) {
  128. let str = '';
  129. for(let i = 0; i < data.length; i++){
  130. if(data[i]['Dwebp'] && !isSafari) {
  131. str+= `<div class="${sec}-${i+1} slide-item" onclick="window.open('${data[i]['link']}');" style="background-image: url('${data[i]['Dwebp']}');" data-bg="${data[i]['Dwebp']}"></div>`
  132. } else {
  133. str+= `<div class="${sec}-${i+1} slide-item" onclick="window.open('${data[i]['link']}');" style="background-image: url('${data[i]['DimgUrl']}');" data-bg="${data[i]['DimgUrl']}"></div>`
  134. }
  135. }
  136. $(`.${sec}`).html(str);
  137. }
  138. function renderSec05(data) {
  139. let randomIdx = Math.floor(Math.random()*3);
  140. const ran = $('.sec-05__tabdiv .nav-pills li').eq(randomIdx);
  141. const ranDiv = $('.sec-05tab-content>div').eq(randomIdx);
  142. $('.sec-05tab-content>div').hide();
  143. ranDiv.show();
  144. ran.addClass('active');
  145. ran.children().addClass('active');
  146. $('.sec-05 .morelink').attr('href', $('.sec-05__tabdiv .nav-item-link.active').data('link'));
  147. let temp = data[2]['data'];
  148. for(let i = 0; i < temp.length; i++){
  149. if(temp[i]["tab"] == '最夯設計'){
  150. let str = '';
  151. let sub = temp[i]["data"];
  152. for(let j = 0; j < sub.length; j++){
  153. str+= `<div class="tabpar__card" onclick="window.open('${sub[j]['link']}');">
  154. <div class="tabpar__card__imgfr mb-2" style="background-image: url('${sub[j]['imgUrl']}');" data-bg="${sub[j]['imgUrl']}"></div>
  155. <h5 class="mb-2 me-2">${sub[j]['title']}</h5>
  156. <p class="mt-2">${sub[j]['description']}</p>
  157. </div>`;
  158. }
  159. $('#pills-hot-tab .tabpar').html(str);
  160. }
  161. if(temp[i]["tab"] == '影音實錄'){
  162. let str = '';
  163. let sub = temp[i]["data"];
  164. for(let j = 0; j < sub.length; j++){
  165. str+= `<div class="tabpar__card" onclick="window.open('${sub[j]['link']}');">
  166. <div class="tabpar__card__imgfr mb-2" style="background-image: url('${sub[j]['imgUrl']}');" data-bg="${sub[j]['imgUrl']}"><img data-src="images/Play-Button.webp" alt="" class="tabpar__card__play lazyload"></div>
  167. <h5 class="mb-2 me-2">${sub[j]['title']}</h5>
  168. <p class="mt-2">${sub[j]['description']}</p>
  169. </div>`;
  170. }
  171. $('#pills-video-tab .tabpar').html(str);
  172. }
  173. if(temp[i]["tab"] == '專欄文章'){
  174. let str = '';
  175. let sub = temp[i]["data"];
  176. for(let j = 0; j < sub.length; j++){
  177. str+= `<div class="tabpar__card" onclick="window.open('${sub[j]['link']}');">
  178. <div class="tabpar__card__imgfr mb-2" style="background-image: url('${sub[j]['imgUrl']}');" data-bg="${sub[j]['imgUrl']}"></div>
  179. <h5 class="mb-2 me-2">${sub[j]['title']}</h5>
  180. <p class="mt-2">${sub[j]['description']}</p>
  181. </div>`;
  182. }
  183. $('#pills-blog-tab .tabpar').html(str);
  184. }
  185. }
  186. const cardText = document.querySelectorAll('.tabpar__card p');
  187. cardText.forEach((item, i) => {
  188. let len = item.textContent.length;
  189. if(len > 18) {
  190. let str = item.textContent.substring(0, 18) + '...';
  191. item.textContent = str;
  192. }
  193. })
  194. $('.sec-05__tabdiv .nav-pills button').on('click', function(event){
  195. event.preventDefault();
  196. $('.sec-05__tabdiv .nav-pills li').removeClass('active');
  197. $('.sec-05__tabdiv .nav-pills li button').removeClass('active');
  198. $(this).addClass('active');
  199. $(this).parent().addClass('active');
  200. $('.sec-05tab-content>div').hide();
  201. var target = $(this).attr('id');
  202. $(`#pills-tab #${target}`).show();
  203. $('.sec-05tab-content .tabpar').slick('setPosition');
  204. });
  205. $(`.sec-05tab-content .tabpar`).slick({
  206. arrows: true,
  207. slidesToShow: 3,
  208. infinite: false,
  209. dots: false,
  210. slidesToScroll: 1,
  211. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 35px;color: black;"></i></button>',
  212. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 35px;color: black;"></i></button>'
  213. });
  214. $('.sec-05__tabdiv .nav-item-link').click(function() {
  215. $('.sec-05 .morelink').attr('href',$('.sec-05__tabdiv .nav-item-link.active').data('link'));
  216. });
  217. }
  218. function renderSec06(data) {
  219. let temp = data[3]['data'];
  220. let str = '';
  221. for(let i = 0; i < temp.length; i++){
  222. if(temp[i].video == 'true'){
  223. str+= `<div class="sec-06__card" onclick="window.open('${temp[i]['link']}');">
  224. <div class="sec-06__card__outer"><div class="sec-06__card__imgfr mb-2" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"><img class="sec-06__card__play lazyload" data-src="images/Play-Button.webp"></div></div>
  225. <h5 class="mb-2 mt-2">${temp[i]['title']}</h5>
  226. <p class="mt-2">${temp[i]['description']}</p>
  227. </div>`;
  228. } else {
  229. str+= `<div class="sec-06__card" onclick="window.open('${temp[i]['link']}');">
  230. <div class="sec-06__card__outer"><div class="sec-06__card__imgfr mb-2" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"></div></div>
  231. <h5 class="mb-2 mt-2">${temp[i]['title']}</h5>
  232. <p class="mt-2">${temp[i]['description']}</p>
  233. </div>`;
  234. }
  235. }
  236. $('.sec-06 .sec-06__slider').html(str);
  237. $('.sec-06__slider').slick({
  238. arrows: true,
  239. dots: false,
  240. speed: 800,
  241. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 30px;color: white;"></i></button>',
  242. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 30px;color: white;"></i></button>'
  243. });
  244. const cardText = document.querySelectorAll('.sec-06__card p');
  245. cardText.forEach((item, i) => {
  246. let len = item.textContent.length;
  247. if(len > 20) {
  248. let str = item.textContent.substring(0, 40) + '...';
  249. item.textContent = str;
  250. }
  251. });
  252. }
  253. function renderSec07(data) {
  254. let temp = data[5]['data'];
  255. let str = '';
  256. for(let i = 0; i < temp.length; i++){
  257. str+= `<div class="sec-07__slider-${i+1} slide-item" onclick="window.open('${temp[i]['link']}');" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"></div>`
  258. }
  259. $(`.sec-07__slider`).html(str);
  260. $(".sec-07__slider").slick({
  261. dots: false,
  262. autoplay: true,
  263. arrows: false,
  264. slidesToShow: 4,
  265. slidesToScroll: 1,
  266. autoplaySpeed: 7000,
  267. initialSlide: 0,
  268. infinite: true,
  269. });
  270. }
  271. function renderSec08(data) {
  272. let temp = data[4]['data'];
  273. let str = '';
  274. for(let i = 0; i < temp.length; i++){
  275. if(temp[i].video == 'true'){
  276. str+= `<div class="sec-08__slider-${i+1} sec-08__card col-12 mx-2" onclick="window.open('${temp[i]['link']}');">
  277. <div class="sec-08__imgfr mb-2" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"><img class="sec-08__card__play lazyload" data-src="images/Play-Button.webp"></div>
  278. <h5 class="mb-2 me-2">${temp[i]['title']}</h5>
  279. <p class="mb-2 me-2">${temp[i]['description']}</p>
  280. </div>`;
  281. } else {
  282. str+= `<div class="sec-08__slider-${i+1} sec-08__card col-12 mx-2" onclick="window.open('${temp[i]['link']}');">
  283. <div class="sec-08__imgfr mb-2" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"></div>
  284. <h5 class="mb-2 me-2">${temp[i]['title']}</h5>
  285. <p class="mb-2 me-2">${temp[i]['description']}</p>
  286. </div>`;
  287. }
  288. }
  289. $('.sec-08__slider').html(str);
  290. $(".sec-08__slider").slick({
  291. arrows: true,
  292. slidesToShow: 1,
  293. infinite: false,
  294. dots: false,
  295. slidesToShow: 3,
  296. centerPadding: '12px',
  297. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 35px;color: black;"></i></button>',
  298. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 35px;color: black;"></i></button>'
  299. });
  300. const cardText = document.querySelectorAll('.sec-08__card p');
  301. cardText.forEach((item, i) => {
  302. let len = item.textContent.length;
  303. if(len > 20) {
  304. let str = item.textContent.substring(0, 20) + '...';
  305. item.textContent = str;
  306. }
  307. })
  308. }
  309. function renderSec09(data) {
  310. let temp = data[6]['data'];
  311. let str = '';
  312. for(let i = 0; i < temp.length; i++){
  313. if(temp[i].video !== 'false') {
  314. str+= `<div class="sec-09__slider-1 sec-09__card col-12 mx-2" onclick="window.open('${temp[i]['link']}');">
  315. <div class="sec-09__imgfr mb-2" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"><img class="sec-09__card__play lazyload" data-src="images/Play-Button.webp"></div>
  316. <p class="sec-09__cardtxt">${temp[i]['title']}</p>
  317. </div>`
  318. } else {
  319. str+= `<div class="sec-09__slider-1 sec-09__card col-12 mx-2" onclick="window.open('${temp[i]['link']}');">
  320. <div class="sec-09__imgfr mb-2" style="background-image: url('${temp[i]['imgUrl']}');" data-bg="${temp[i]['imgUrl']}"></div>
  321. <p class="sec-09__cardtxt">${temp[i]['title']}</p>
  322. </div>`
  323. }
  324. }
  325. $('.sec-09__slider').html(str);
  326. $(".sec-09__slider").slick({
  327. autoplay: true,
  328. autoplaySpeed: 7000,
  329. arrows: true,
  330. slidesToShow: 4,
  331. infinite: true,
  332. dots: false,
  333. slidesToScroll: 1,
  334. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 35px;color: black;"></i></button>',
  335. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 35px;color: black;"></i></button>'
  336. });
  337. }
  338. function renderSec10(data) {
  339. renderRecStr("sec-10", data[7]['data'].slice(0, 6));
  340. renderRecStr("sec-11", data[8]['data'].slice(0, 6));
  341. }
  342. function renderRecStr(sec, data) {
  343. let str = '';
  344. for(let i = 0; i < data.length; i++){
  345. //console.log(data[i]['description'].length);
  346. if(data[i]['description'].length > 0) {
  347. data[i]['description'].split(',');
  348. data[i]['description'] = data[i]['description'].split(',').slice(1).join("");
  349. }
  350. if(data[i].video !== 'false') {
  351. str+= `<div class="${sec}__card col-4 mb-3" onclick="window.open('${data[i]['link']}');">
  352. <div class="${sec}__card-img mb-2" style="background-image: url('${data[i]['imgUrl']}');" data-bg="${data[i]['imgUrl']}"><img class="${sec}__card__play lazyload" data-src="images/Play-Button.webp"></div>
  353. <h5 class="me-2">${data[i]['title']}</h5>
  354. <p class="${sec}__cardtxt me-2">${data[i]['description']}</p>
  355. </div>`
  356. } else {
  357. str+= `<div class="${sec}__card col-4 mb-3" onclick="window.open('${data[i]['link']}');">
  358. <div class="${sec}__card-img mb-2" style="background-image: url('${data[i]['imgUrl']}');" data-bg="${data[i]['imgUrl']}"></div>
  359. <h5 class="me-2">${data[i]['title']}</h5>
  360. <p class="${sec}__cardtxt me-2">${data[i]['description']}</p>
  361. </div>`
  362. }
  363. }
  364. $(`.${sec} .row`).html(str);
  365. const cardText = document.querySelectorAll(`.${sec}__card p`);
  366. cardText.forEach((item, i) => {
  367. let len = item.textContent.length;
  368. if(len > 18) {
  369. let str = item.textContent.substring(0, 18) + '...';
  370. item.textContent = str;
  371. }
  372. })
  373. }
  374. function renderVideo(data) {
  375. let temp = data[9];
  376. console.log(data[9]);
  377. $('.sec-06__videotxt').text(temp['title']);
  378. console.log('test');
  379. $('.sec-06__video__imgfr').css('background-image', `url(https://img.youtube.com/vi/${temp['yt']}/hqdefault.jpg)`);
  380. $('#videoModal').on('shown.bs.modal', function () {
  381. $('#videoModal iframe').attr('src', `https://www.youtube.com/embed/${temp['yt']}?controls=0&autoplay=1&amp;enablejsapi=1&amp;origin=https%3A%2F%2Fm.hhh.com.tw&amp;widgetid=1`);
  382. });
  383. $('#videoModal').on('hidden.bs.modal', function () {
  384. $('#videoModal iframe').removeAttr('src');
  385. });
  386. }
  387. function renderTrending(result){
  388. let temp = result[10]['data'];
  389. let str = '';
  390. for(let i = 0; i < temp.length; i++){
  391. str += `<a class="dropbox__hots__link" href="https://hhh.com.tw/search/lists/case/${temp[i]}-keyword/">${temp[i]}</a>`
  392. }
  393. $('.dropbox__hots').html(`<strong class="dropbox__hots__title">熱搜關鍵字:</strong>${str}`);
  394. }
  395. function tab2 () {
  396. if(('.dropbox__tabdiv').length){
  397. // Show the first tab by default
  398. $('.dropbox-tab-content>div').hide();
  399. $('.dropbox-tab-content>div:first').show();
  400. $('.dropbox__tabdiv .nav-pills li:first').addClass('active');
  401. $('.dropbox__tabdiv .nav-pills li:first button').addClass('active');
  402. // Change tab class and display content
  403. $('.dropbox__tabdiv .nav-pills button').on('click', function(event){
  404. event.preventDefault();
  405. $('.dropbox__tabdiv .nav-pills li').removeClass('active');
  406. $('.dropbox__tabdiv .nav-pills li button').removeClass('active');
  407. $(this).addClass('active');
  408. $(this).parent().addClass('active');
  409. $('.dropbox-tab-content>div').hide();
  410. var target = $(this).attr('id');
  411. $(`#pills-tab-2 #${target}`).show();
  412. });
  413. }
  414. }
  415. tab2();
  416. window.addEventListener('scroll', fixedOnScroll);
  417. const navbar = document.querySelector('.navbar-main');
  418. function fixedOnScroll() {
  419. }
  420. $(window).scroll(function() {
  421. if ( $(this).scrollTop() > 800 ){
  422. $('.fixed-btn').fadeIn(222);
  423. } else {
  424. $('.fixed-btn').stop().fadeOut(222);
  425. }
  426. }).scroll();
  427. $('.btn-gotop').click(function () {
  428. $('html, body').animate({
  429. scrollTop: 0
  430. }, 500)
  431. });
  432. $('.navbar-search img').click(function(){
  433. $('.navbar-search .dropbox').toggleClass('open');
  434. if($('.navbar-search .dropbox').hasClass('open')) {
  435. $('.navbar-nav .nav-item>.dropbox').addClass('d-none');
  436. } else {
  437. $('.navbar-nav .nav-item>.dropbox').removeClass('d-none');
  438. }
  439. });
  440. $('.sec-00__close').click(function(){
  441. $(this).css('display', 'none');
  442. $('.sec-00').addClass('bannerClose');
  443. //$('.sec-02').css('padding-top', '53px');
  444. sticky = 0;
  445. });
  446. document.addEventListener('lazybeforeunveil', function(e){
  447. var bg = e.target.getAttribute('data-bg');
  448. if(bg){
  449. e.target.style.backgroundImage = 'url(' + bg + ')';
  450. }
  451. });
  452. $('.container_match2').hide();
  453. $('.match__next').click(function() {
  454. $('.container_match').fadeOut(0);
  455. $('.container_match2').fadeIn(500);
  456. })
  457. //jQuery time
  458. var current_fs, next_fs, previous_fs; //fieldsets
  459. var left, opacity, scale; //fieldset properties which we will animate
  460. var animating; //flag to prevent quick multi-click glitches
  461. $(".next").click(function(){
  462. if(animating) return false;
  463. animating = true;
  464. current_fs = $(this).parent().parent();
  465. next_fs = $(this).parent().parent().next();
  466. //activate next step on progressbar using the index of next_fs
  467. $(".form-progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
  468. //show the next fieldset
  469. next_fs.animate({opacity: 1}, {
  470. step: function(now, mx) {
  471. //as the opacity of current_fs reduces to 0 - stored in "now"
  472. //1. scale current_fs down to 80%
  473. scale = 0 + (1 + now) * .5 ;
  474. //2. bring next_fs from the right(50%)
  475. left = (now * 50)+"%";
  476. //3. increase opacity of next_fs to 1 as it moves in
  477. opacity = 0 + now;
  478. next_fs.css({
  479. 'transform': 'scale('+scale+')',
  480. });
  481. next_fs.css({'opacity': opacity});
  482. },
  483. duration: 400,
  484. complete: function(){
  485. next_fs.show();
  486. animating = false;
  487. },
  488. //this comes from the custom easing plugin
  489. easing: 'easeInOutBack'
  490. });
  491. //hide the current fieldset with style
  492. current_fs.animate({opacity: 0}, {
  493. step: function(now, mx) {
  494. //as the opacity of current_fs reduces to 0 - stored in "now"
  495. //1. scale current_fs down to 80%
  496. scale = 1 - (1 - now) * 0.2;
  497. //2. bring next_fs from the right(50%)
  498. left = (now * 50)+"%";
  499. //3. increase opacity of next_fs to 1 as it moves in
  500. opacity = 1 - now;
  501. current_fs.css({
  502. 'transform': 'scale('+scale+')',
  503. });
  504. next_fs.css({'opacity': opacity});
  505. },
  506. duration: 400,
  507. complete: function(){
  508. current_fs.hide();
  509. animating = false;
  510. },
  511. //this comes from the custom easing plugin
  512. easing: 'easeInOutBack'
  513. });
  514. });
  515. $('.close').click(function () {
  516. window.close();
  517. })