Almost all major web sites offer browsing image features, but to the user feel very different, some sites are good, but also have a website to browse pictures from this one to the next URL will change, obviously browsing is through get way through a request to achieve, this way, a sense of pause, the server request too frequently. But by using AJAX requests for a set of image data to be browsed and saving the results in an array, the effect is significantly different, and browsing the picture will be much smoother. Saving picture data in a JavaScript array offers a lot of benefits. One, based on the image display effect of the array 1, slide effect 2, product index effect 3, special advertising effect
Second, the product index effect is not complete sample code (in this case only the product index)
1, Product array
var product_v=new Array ();
var m=new Map ();
M.put ("ISFW", false);
M.put ("Sortnum", "0");
M.put ("normal", "0");
M.put ("Iswm", false);
M.put ("Jgms", "price");
M.put ("Good", "0");
M.put ("qy_id", "stone");
M.put ("id", "50");
M.put ("Iszm", false);
M.put ("Height", "480");
M.put ("Grade", "1");
M.put ("Iscz", false);
M.put ("ISLs", true);
M.put ("QYMC", "Chinese odd stone");
M.put ("width", "640");
M.put ("Uptime", "2011-09-25 12:06:52.0");
M.put ("label_id", "3307");
M.put ("label", "Platypus");
M.put ("unit", "piece");
M.put ("num", "1");
M.put ("Cplabel", "Yangtze Stone");
M.put ("filename", "1316923598012.jpg");
M.put ("Numprice", "0");
//...
Product_v.push (m);
2. Implementation method
function _loadcpsy (uid,list,pwidth) {
var cols=6;
var rows=3;
var scalewidth=parseint (parseint (pWidth-8)/cols)-12);
var scaleheight=scalewidth;
var html= "";
var galleryuid=uid+ "Gallery";
var p=new pageobj ({//Group object
Uid:uid,
List:list, this article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20121120/34050.html
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.