javascript - Simple-Jekyll-Search will no longer trigger on-click after firing smoothState -


i trying implement on-click search event, using simple-jekyll-search on page smoothstate.

after following suggestion written in question: how simulate button press in javascript, trigger searching in simple-jekyll-search, , adding following snippet library, appears onclick event no longer triggers search event after smoothstate loads new page.

$('#yourbutton').click(function(){     render( searcher.search(store, opt.searchinput.value) ); }) 

any suggestions appreciated.

there's section in faq section of readme might help. here's excerpt:

help! $(document).ready() plugins work fine when refresh break on second page load.

smoothstate.js provides onafter callback function allows re-run plugins. can tricky if you're unfamiliar how ajax works.

when run plugin on $(document).ready(), it's going register on elements on page. since we're injecting new elements every load, need run plugins again, scoping new stuff.

a way wrap plugin initializations in function call on both $.fn.ready() , onafter. you'll want specify context each time initialize plugins don't double-bind them. called "module execution controller".


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -