JQuery implements the drop-down function instance code.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.