JQuery implements the drop-down function instance code.
If you don't talk much about it, paste the Code directly. The specific code is as follows:
<Script> var str = ''; if (page =" ") page = 1; var stop = true; // trigger the switch, prevent multiple call events $ (window ). scroll (function (event) {// load new content 100 when the content is scrolled to the bottom. Load it when it is 100 pixels away from the bottom. if ($ (this ). scrollTop () + $ (window ). height () + 10 >=$ (document ). height () & $ (this ). scrollTop ()> 10) {// if (stop = true) {// stop = false; // var canshu = "page/" + page + "; var url = ""; var parm = {'page': page}; page = page + 1; // The current page number to be loaded // The loading prompt $ ("# showlists "). appe Nd ("<li class = 'ajaxtips '> <div style = 'font-size: 2em'> Loding ..... </Div> <> "); $. post (url, parm, function (data) {if (data. count = 0) Completed Certificate ('.prolist-abtn'finished .html ('all loaded already '); return ;}$. each (eval (data), function (data, val) {var url1 = ""; $ (". ajaxtips "). hide (); str = '<div class = "content" id = "showdiv">'; str + = '<div class = "cont clearfix"> '; str + = '<a href = "url"> <div class = "cont_img fl">'; str + = ' </div> '; str + =' <div class = "cont_list fl"> <p> '+ val. sceneryname + '</p> <ul class = "cont_list fl">'; str + = '<li class = "cont_list2"> <span> ¥ </span> '; str + = '<strong>' + val. starting from sellerprice + '</strong> <I> ¥' + val. sellerprice + '</I> </li>'; str + = '</ul> </div> </a> </div> '; $ ("# showdiv "). append (str); // load the new content to the end of the content}); stop = true ;}, 'json') }}); </script>
The above code is the sample code for jQuery to implement the drop-down function. I hope it will be helpful to you!
Articles you may be interested in:
- Asp.net + jquery scroll bar to load data drop-down controls
- Sample Code for jquery to dynamically load the select drop-down box
- Implementation example of JQuery asynchronous loading of the infinite drop-down box cascade Function
- JQuery + AJAX implement no refreshing drop-down load more
- JQuery simulates pull and refresh pull-down loading more pages and their principles
- JQuery achieves data loading effect by imitating the pull-down scroll bar of Weibo