第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

對(duì)于.replaceWith() .call(this) 在實(shí)際效果中的不解。

對(duì)于.replaceWith() .call(this) 在實(shí)際效果中的不解。

從網(wǎng)上下載的一個(gè)jquery文字特效代碼,有兩處不懂的,請(qǐng)大神教一下。效果顯示jQuery基于CSS3文字動(dòng)畫特效html文件中有<p?class="ex1">TEXTYLE</p> <p?class="ex2">FLIP</p>js文件中 (function($){?? ?$.fn.textyleF?=?function(options){ ???var?target?=?this; ???var?targetTxt?=?target.contents(); ???var?defaults?=?{ ?????duration?:?1000, ?????delay?:?150, ?????easing?:?'ease', ?????callback?:?null ???}; ???var?setting?=?$.extend(defaults,?options); ???targetTxt.each(function(){ ?????var?texts?=?$(this); ?????if(this.nodeType?===?3){ ???????mkspn(texts); ?????} ???}); ???function?mkspn(texts){ ?????texts.replaceWith(texts.text().replace(/(\S)/g,'<span>$1</span>')); ?????console.log("texts="+texts); ???} ???return?this.each(function(i){ ?????var?child?=?target.children('span'); ?????target.css('opacity',1); ?????child.each(function(i){ ???????$(this).delay(setting.delay*i) ?????????.queue(function(next)?{ ?????????$(this).css({ ???????????display?:?'inline-block', ???????????transform?:?'rotateY(0deg)?rotateX(0deg)', ???????????opacity?:?1, ???????????transitionDuration?:?setting.duration?+?'ms', ???????????transitionTimingFunction?:?setting.easing ?????????}) ?????????next(); ???????}); ???????if(typeof?setting.callback?===?'function'){ ?????????$(this).on('transitionend',?function()?{ ?????????? ???????????setting.callback.call(this); ??????????? ?????????}); ???????}?else?{ ?????????console.error('Textyle.js:?`setting.callback`?must?be?a?function.'); ???????} ?????}); ???}); ?}; }(?jQuery?)); $(window).on('load',function(){ ??$('.ex1').textyleF(); ??$('.ex2').textyleF({ ??????duration?:?2000, ??????delay?:?200, ??????easing?:?'cubic-bezier(0.77,?0,?0.175,?1)', ??????callback?:?function(){ ????????$(this).css({ ??????????color?:?'#fff', ??????????transition?:?'1s', ????????}); ????????$('.desc').css('opacity',1); ??????} ????}); ??});問(wèn)題1: texts.replaceWith(texts.text().replace(/(\S)/g,'<span>$1</span>'));????外層的replaceWith()的作用是把括號(hào)里的內(nèi)容替換texts的文本對(duì)么?????但是控制臺(tái)打印texts,不是<span>T</span>這樣的,是Object [ #text ]?問(wèn)題2:setting.callback.call(this);?? 1、 我對(duì)call和this的用法一直沒(méi)搞懂,這里要實(shí)現(xiàn)的效果應(yīng)該是調(diào)用$('.ex2')..textyleF()里設(shè)置的callback吧???? 2、那.call(this);在這里作用是什么?前后的this都是HTMLSpanElement。??? 3、call()可以改變this的指向?但是在這之前打印this是 。<span?style="display:?inline-block;?t…ier(0.77,?0,?0.175,?1);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…ier(0.77,?0,?0.175,?1);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…ier(0.77,?0,?0.175,?1);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…ier(0.77,?0,?0.175,?1);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);"> <span?style="display:?inline-block;?t…or:?rgb(255,?255,?255);">?在此句之后打印this,就沒(méi)有<span style="display: inline-block; t…ier(0.77, 0, 0.175, 1);">所以調(diào)用了.call(this)的作用是什么?this指向變了?問(wèn)題3:①window.onload == $(window).on('load') ???????????? ② $(function($){});== $(document).ready()? ???????????? ③ ②在dom樹加載完就執(zhí)行,所以是在①之前執(zhí)行??????????? ④ (function($){...})(jquery);是自執(zhí)行匿名函數(shù)?也是在dom加載完運(yùn)行,那和$(function($){});有區(qū)別?
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 1242 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)