好!欢迎访问迷津渡口 现在时间是: 天气 °C ~ °C

迷津渡口

越感到迷惑 越接近真理

pjax javascript失效解决(小指亲测)

实际上pjax部署后javascript失效解决非常简单,只是需要一点时间整理~

  1. 使用一个函数包裹所有在页面载入后执行绑定事件的javascript语句

    小指使用的是jQuery,一般就是$(document).ready(function() {});就是这个function里面的语句啦~

    普通的javascript就是window.onload事件绑定的函数啦。

    例如将此函数设为init();

    function init() {...}

  2. 页面载入完成执行这个函数初始化事件绑定:

    $(document).ready(init(););

  3. pjax在pjax完成后执行绑定函数init即可:

    $(document).on('pjax:complete', function() {init();})


就是这么简单啦~

跨域引用javascript则需要了解其中的原理重新绑定事件,没有捷径!

点赞11
 标签: pjax javascript失效
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
gofishbaits
 gofishbaits 约 12 小时前回复
#164
<a href="http://www.bonnieapp.com/nike-lebron-14-multicolor-rojo-kurpesf">nike lebron 14 multicolor rojo</a> <a href="http://www.ccbgdk.com/nike-air-yeezy-2-rouge-october-mercado-livre-kurpesf">nike air yeezy 2 rouge october mercado livre</a> <a href="http://www.cshjylgs.com/retro-jordan-5-blanc-argent-schuheg">retro jordan 5 blanc argent</a> <a href="http://www.dgshbst.com/nike-kd-trey-5-team-orange-gr%C3%A5-eyes-scarpef">nike kd trey 5 team orange gr氓 eyes</a> <a href="http://www.fetchparkbar.com/nike-mercurial-victory-iv-lyser%C3%B8d-and-lilla-kurpesa">nike mercurial victory iv lyser酶d and lilla</a> <a href="http://www.fsithelp.com/nike-air-max-hyperfuse-army-vert-kurpesd">nike air max hyperfuse army vert</a>
gofishbaits http://www.gofishbaits.com/
danieldavinci
 danieldavinci 2019-04-24 11:56回复
#163
<a href="http://www.taiwanmeinet.com/nike-sb-dunk-mid-pro-black-shoesh">nike sb dunk mid pro black</a> <a href="http://www.talkwithgirl.com/nike-lebron-12-argent-jaune-chaussuresl">nike lebron 12 argent jaune</a> <a href="http://www.mamatale.com/adidas-black-and-white-shoes-kids-shoesj">adidas black and white shoes kids</a> <a href="http://www.strongtale.com/stanford-cardinal-nike-ncaa-col-aro-swooshflex-cap-hatk">stanford cardinal nike ncaa col aro swooshflex cap</a> <a href="http://www.iranpayamco.com/adidas-pr%C3%B8dator-sort-and-gul-skoj">adidas pr酶dator sort and gul</a> <a href="http://www.hapeid.com/grey-and-orange-polo-shirt-poloh">grey and orange polo shirt</a>
danieldavinci http://www.danieldavinci.com/
rollaname
 rollaname 2019-04-24 07:04回复
#162
<a href="http://www.germanxtube.com/hombres-nike-air-max-tailwind-5-dark-azul-naranja-zapatosl">hombres nike air max tailwind 5 dark azul naranja</a> <a href="http://www.eugenesklyar.com/nike-hypervenom-phelon-ii-grey-green-black-shoesk">nike hypervenom phelon ii grey green black</a> <a href="http://www.bamadu.com/menn-nike-air-max-2016-svart-r%C3%B8d-gr%C3%B8nn-obuvi">menn nike air max 2016 svart r酶d gr酶nn</a> <a href="http://www.gamekeyssale.com/nike-air-max-1-prm-denim-turquoise-hvit-obuvk">nike air max 1 prm denim turquoise hvit</a> <a href="http://www.aktuelresim.com/nike-zoom-clear-out-1-gr%C3%A5-svart-obuvi">nike zoom clear out 1 gr氓 svart</a> <a href="http://www.myshoesonsale.com/nike-free-flyknit-5.0-v2-negro-blanco-zapatosl">nike free flyknit 5.0 v2 negro blanco</a>
rollaname http://www.rollaname.com/
smartiesland
 smartiesland 2019-04-23 00:23回复
#161
<a href="http://www.tkbelazig.com/femminile-air-jordan-retro-3-viola-blu-scarpei">femminile air jordan retro 3 viola blu</a> <a href="http://www.swiftgrocer.com/dam%C3%A4nner-asics-gel-kayano-20-wei%C3%9F-rosa-schuhej">dam盲nner asics gel kayano 20 wei脽 rosa</a> <a href="http://www.warrnamboolag.com/chicago-cubs-47-mlb-axis-47-clean-up-cap-hath">chicago cubs 47 mlb axis 47 clean up cap</a> <a href="http://www.paineesq.com/femmes-nike-lebron-12-oranger-jaune-chaussuresh">femmes nike lebron 12 oranger jaune</a> <a href="http://www.gemmatyndall.com/air-jordan-super-fly-cielo-blu-grigio-scarpel">air jordan super fly cielo blu grigio</a> <a href="http://www.cestreaming.com/womens-nike-air-force-1-purple-orange-shoesj">womens nike air force 1 purple orange</a>
[url=http://www.smartiesland.com/]smartiesland[/url]
hiltonskyshop
 hiltonskyshop 2019-04-22 23:37回复
#160
<a href="http://www.truthtapes.com/nike-kyrie-3-oro-rosado-zapatosk">nike kyrie 3 oro rosado</a> <a href="http://www.veskopetrov.com/kvinders-nike-flyknit-lunar-3-sort-lilla-skoi">kvinders nike flyknit lunar 3 sort lilla</a> <a href="http://www.kaosmotogp.com/nike-air-max-2017-hvit-gr%C3%B8nn-obuvl">nike air max 2017 hvit gr酶nn</a> <a href="http://www.doularhythms.com/womens-nike-roshe-yeezy-boost-yellow-blue-shoesh">womens nike roshe yeezy boost yellow blue</a> <a href="http://www.animalpainvet.com/nike-air-max-stefan-janoski-wolf-grigio-scarpei">nike air max stefan janoski wolf grigio</a> <a href="http://www.texarillo.com/nike-zoom-vomero-dam%C3%A4nner-silber-wei%C3%9F-schuhej">nike zoom vomero dam盲nner silber wei脽</a>
hiltonskyshop http://www.hiltonskyshop.com/
seesoshow
 seesoshow 2019-04-22 19:23回复
#159
<a href="http://www.sophiecrooks.com/asics-gel-lyte-5-svart-r%C3%B8d-obuvi">asics gel lyte 5 svart r酶d</a> <a href="http://www.hkelitemodels.com/nike-bomba-finale-ii-blanco-verde-zapatosl">nike bomba finale ii blanco verde</a> <a href="http://www.graciecomm.com/nike-sb-zoom-stefan-janoski-tutti-nero-scarpeh">nike sb zoom stefan janoski tutti nero</a>
seesoshow http://www.seesoshow.com/
allstudentshuttle
 allstudentshuttle 2019-04-22 06:34回复
#158
<a href="http://www.impulsodigital.net/adidas-climacool-ride-ii-sort-s%C3%B8lv-scarpee">adidas climacool ride ii sort s酶lv</a> <a href="http://www.industrialamps.net/nike-flyknit-lunar-2-femminile-grigio-jack-scarpeg">nike flyknit lunar 2 femminile grigio jack</a> <a href="http://www.jifivillage.net/dam%C3%A4nner-nike-zoom-pegasus-32-beige-kurpesa">dam盲nner nike zoom pegasus 32 beige</a> <a href="http://www.jolkona.net/nike-air-presto-pale-gris-orange-schuhee">nike air presto pale gris orange</a> <a href="http://www.justadrink.net/nike-kd-9-elite-lyser%C3%B8d-dust-grill-kurpesb">nike kd 9 elite lyser酶d dust grill</a> <a href="http://www.kouder.net/air-max-1-ultra-flyknit-wolf-gr%C3%A5-kurpesa">air max 1 ultra flyknit wolf gr氓</a>
allstudentshuttle http://www.allstudentshuttle.net/
ericwinzenried
 ericwinzenried 2019-04-21 17:48回复
#157
<a href="http://www.imovieye.net/adidas-pr%C3%B8dator-k%C3%B8be-online-butye">adidas pr酶dator k酶be online</a> <a href="http://www.inafj.net/dam%C3%A4nner-nike-air-rejuven8-mule-schwarz-wei%C3%9F-butya">dam盲nner nike air rejuven8 mule schwarz wei脽</a> <a href="http://www.infoinvest.net/nike-air-max-1-essential-blu-arancia-obuvb">nike air max 1 essential blu arancia</a> <a href="http://www.innerhumanism.net/nike-roshe-run-noir-and-ice-bleu-scarpec">nike roshe run noir and ice bleu</a> <a href="http://www.inspiriamedia.net/nike-air-max-thea-gul-and-sort-wasp-schuhef">nike air max thea gul and sort wasp</a> <a href="http://www.integralcinema.net/nike-free-5.0-gr%C3%B8nn-quarters-scarpec">nike free 5.0 gr酶nn quarters</a>
ericwinzenried http://www.ericwinzenried.net/
alanyalinks
 alanyalinks 2019-04-21 12:30回复
#156
<a href="http://www.postthatass.com/nike-magista-obra-acc-fg-volt-sort-r%C3%B8d-skoh">nike magista obra acc fg volt sort r酶d</a> <a href="http://www.houseoftys.com/air-jordan-horizon-dark-blu-scarpei">air jordan horizon dark blu</a> <a href="http://www.amvdiplomados.com/femminile-nike-air-zoom-pegasus-33-nero-scarpej">femminile nike air zoom pegasus 33 nero</a> <a href="http://www.ybsimports.com/washington-wizards-throwback-jersey-nflh">washington wizards throwback jersey</a> <a href="http://www.rochlockyer.com/disney-x-coach-mickey-saddle-bag-23-in-glovetanned-leather-wmonogrammed-coachh">disney x coach mickey saddle bag 23 in glovetanned leather wmonogrammed</a> <a href="http://www.allsocialdata.com/femminile-nike-light-up-viola-scarpei">femminile nike light up viola</a>
alanyalinks http://www.alanyalinks.com/
twistnik
 twistnik 2019-04-20 05:42回复
#155
<a href="http://www.ptsbarwinslow.com/zx-flux-super-gr%C3%B8n-skok">zx flux super gr酶n</a> <a href="http://www.sarhallafk.com/nike-huarache-olive-gr%C3%B8nn-obuvi">nike huarache olive gr酶nn</a> <a href="http://www.philippikus.com/nike-air-max-90-mujer-blanco-cielo-azul-flor-zapatosl">nike air max 90 mujer blanco cielo azul flor</a> <a href="http://www.pngoilgas.com/oakley-pit-boss-with-chocolate-frame-vr50-brown-lens-sunglassesh">oakley pit boss with chocolate frame vr50 brown lens</a> <a href="http://www.goficarwash.com/black-texas-flag-hat-hatj">black texas flag hat</a> <a href="http://www.getairtijuana.com/adidas-prossoator-absolado-test-scarpej">adidas prossoator absolado test</a>
twistnik http://www.twistnik.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸