Git Product home page Git Product logo

dulllazyloadtab's Introduction

选项卡懒加载插件

页面存在太多的选项卡切换,一次加载下来?这样子是不实际的!

使用局限:1:请求地址格式需要统一 2:没有做跨域

默认参数

dbUI.dullLazyLoadTab.defaults = {

		//触发按钮
		btnName: '.tab',
		
		//切换内容
		boxName: '.panel',
		
		//请求路径
		url: 'js/',
		
		//请求方式
		type: 'GET',
		
		//请求数据类型
		datatype: 'json',
		
		//请求成功后回调
		callback: null
};

实例化

$('.lazyLoadTab').dullLazyLoadTab({
	url: 'json/',
	callback: function(msg, dataTab) {
		var html = '';
		if (dataTab == 'dig') {
			$.each(msg.data, function(index, val) {
				if (index <= 2) {
					html += '<li class="top-bor clearfix">';
					html += '<em class="range Cff9601 fl">' + (index + 1) + '</em>';
					html += '<a class="wp_w130 wp fl" target="_blank" title="' + val.s_name + '" href="http://ka.17611.com/' + val.page_url + '">' + val.s_name + '</a>';
					html += '<span class="wp_w35 wp fr">' + val.s_id + '</span>';
					html += '</li>';
				} else {
					html += '<li class="top-bor clearfix">';
					html += '<em class="range Ce6e6e6 fl">' + (index + 1) + '</em>';
					html += '<a class="wp_w130 wp fl" target="_blank" title="' + val.s_name + '" href="http://ka.17611.com/' + val.page_url + '">' + val.s_name + '</a>';
					html += '<span class="wp_w35 wp fr">' + val.s_id + '</span>';
					html += '</li>';
				}
			});
		} else if (dataTab == 'book') {
			$.each(msg.data, function(index, val) {
				html += '<li class="top-bor clearfix">';
				html += '<a class="wp_w130 wp fl" target="_blank" title="' + val.s_name + '" href="http://ka.17611.com/' + val.page_url + '">' + val.s_name + '</a>';
				html += '<span class="wp_w35 wp fr">' + val.s_id + '</span>';
				html += '</li>';
			});
		};
		return html;
	}
});

dulllazyloadtab's People

Contributors

dullbear avatar

Watchers

James Cloos avatar  avatar

Forkers

chubby886

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.