当前位置:   article > 正文

jquery 分页 下拉框

jquery下拉框pre
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <style>
  7. *{ margin: 0 ;padding: 0;}
  8. ul,li{ list-style: none;}
  9. #tables{ width: 100%; height: auto;; overflow: hidden; margin-bottom: 40px;;}
  10. #tables li{list-style: none; width: 100px; height: 150px; overflow: hidden; border: 2px solid red; float: left; display: inline;}
  11. #tables li img{ width: 100px; float: left;}
  12. .fenye {
  13. height: 40px;
  14. line-height: 40px;
  15. position: relative; z-index: 88;;
  16. text-align: center;
  17. }
  18. .fenye input {
  19. outline: 0;;
  20. }
  21. .fenye button {
  22. padding: 0 10px;
  23. margin: 0 10px;
  24. height: 40px;
  25. float: left; outline: 0;;
  26. cursor: pointer;
  27. border: 1px solid #ebebeb;
  28. background-color: #ffffff;
  29. }
  30. .fenye .prePage,.fenye .turnPage,.fenye .last-page,.fenye .jump-button{ background:#157fcc ; color: #fff;}
  31. .fenye button:disabled{
  32. background-color: #eee;
  33. }
  34. .fenye .first-page,
  35. .fenye .last-page {
  36. margin: 0;
  37. }
  38. .fenye .pageWrap {
  39. height: 38px;
  40. float: left;
  41. overflow: hidden;border: 1px solid #ebebeb;
  42. }
  43. .fenye .pageWrap ul {
  44. width: 100000px;
  45. height: 40px;
  46. float: left;list-style: none; overflow: hidden;
  47. }
  48. .fenye .pageWrap ul li:first-of-type(1){
  49. border-left: 1px solod #ebebeb;;
  50. }
  51. .fenye .pageWrap ul li:hover{
  52. background-color: #eee;
  53. }
  54. .fenye .pageWrap ul li {list-style: none;
  55. width: 60px;
  56. height: 40px;
  57. border-right: 1px solid #ebebeb;
  58. line-height: 40px;
  59. box-sizing: border-box;
  60. cursor: pointer;
  61. float: left;
  62. }
  63. .fenye .pageWrap ul .sel-page {
  64. background-color: #157fcc; color: #fff;
  65. }
  66. .fenye .jump-text {
  67. width: 60px;
  68. height: 40px;
  69. box-sizing: border-box;
  70. text-align: center;
  71. margin: 0 5px;
  72. float: left;
  73. }
  74. .fenye .jump-button {
  75. margin: 0;
  76. float: left; position: relative; z-index: 89;;
  77. }
  78. .fenye .total-pages,
  79. .fenye .total-count {
  80. margin-left: 10px;
  81. float: left;
  82. font-size: 14px;
  83. }
  84. .total-count{border: 1px solid #ebebeb;
  85. background-color: #ffffff; padding: 0 10px;}
  86. </style>
  87. </head>
  88. <body>
  89. <div id="tables">
  90. <li>11 动态数据</li>
  91. </div>
  92. <div class=" fenye" id="fenbox"></div>
  93. <div id="saa">重新初始化2</div>
  94. <div style="padding: 10px;;">-----------------------------------</div>
  95. <div id="tables2">
  96. <li>22 动态数据</li>
  97. </div>
  98. <div class=" fenye" id="fenbox2"></div>
  99. <script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"> </script>
  100. <script >
  101. (function($, window, document) {
  102. // 定义构造函数
  103. function Paging(el, options) {
  104. this.el = el;
  105. var defaults = {
  106. pageNo: 1, // 初始页码
  107. totalPages: 1, //总页数
  108. totalCount: 1, // 条目总数
  109. slideSpeed: 0, // 缓动速度
  110. jump: false, // 支持跳转,
  111. first:true,
  112. callback:function() {} // 回调函数,
  113. };
  114. this.options = $.extend({},defaults,options)
  115. //console.log("最喜欢总", this.options );
  116. this.init(this.el);
  117. }
  118. // 给实例对象添加公共属性和方法
  119. Paging.prototype = {
  120. constructor: Paging,
  121. init: function(ele) {
  122. this.createDom();
  123. this.bindEvents(ele);
  124. },
  125. createDom: function() {
  126. var that = this,
  127. ulDom = '',
  128. jumpDom = '',
  129. content = '',
  130. liWidth = 60, // li的宽度
  131. totalPages = that.options.totalPages||1, // 总页数
  132. wrapLength = 0;
  133. if(typeof totalPages!='number'||typeof totalPages<=0){
  134. totalPages=1;
  135. }
  136. totalPages > 5 ? wrapLength = 5 * liWidth : wrapLength = totalPages * liWidth;
  137. if(totalPages<=1){
  138. ulDom += '<li class="sel-page">' + 1 + '</li>';
  139. }else{
  140. for (var i = 1; i <= that.options.totalPages; i++) {
  141. i != 1 ? ulDom += '<li>' + i + '</li>' : ulDom += '<li class="sel-page">' + i + '</li>';
  142. }
  143. }
  144. that.options.jump ? jumpDom = '<input type="text" placeholder="1" class="jump-text jumpText" ><button type="button" class="jump-button jumpBtn">跳转</button>' : jumpDom = '';
  145. content = '<button type="button" class="turnPage firstPage first-page">首页</button>' +
  146. '<button class="turnPage prePage" >上一页</button>' +
  147. '<div class="pageWrap" style="width:' + wrapLength + 'px">' +
  148. '<ul class="pageSelect" style="transition:all ' + that.options.slideSpeed + 'ms">' +
  149. ulDom +
  150. '</ul></div>' +
  151. '<button class="turnPage nextPage" >下一页</button>' +
  152. '<button type="button" class="last-page lastPage">尾页</button>' +
  153. jumpDom +
  154. '<p class="total-pages">共 ' +
  155. that.options.totalPages +
  156. ' 页</p>' +
  157. '<p class="total-count">' +
  158. that.options.totalCount +
  159. '</p>';
  160. that.el.html(content);
  161. },
  162. bindEvents: function(ele) {
  163. var ele=ele;
  164. var that = this,
  165. pageSelect =ele.find('.pageSelect'), // ul
  166. lis = pageSelect.children(), // li的集合
  167. liWidth = lis[0]?(lis[0].offsetWidth):0, // li的宽度
  168. totalPages = that.options.totalPages, // 总页数
  169. pageIndex = that.options.pageNo, // 当前选择的页码
  170. distance = 0, // ul移动距离
  171. prePage = ele.find('.prePage'),
  172. nextPage = ele.find('.nextPage'),
  173. firstPage = ele.find('.firstPage'),
  174. lastPage = ele.find('.lastPage'),
  175. jumpBtn = ele.find('.jumpBtn'),
  176. jumpText =ele.find('.jumpText');
  177. // console.log(firstPage);
  178. prePage.on('click', function() {
  179. pageIndex--;
  180. that.options.first=true;
  181. if (pageIndex < 1) pageIndex = 1;
  182. handles(pageIndex);
  183. })
  184. nextPage.on('click', function() {
  185. pageIndex++;
  186. that.options.first=true;
  187. if (pageIndex > lis.length) pageIndex = lis.length;
  188. handles(pageIndex);
  189. })
  190. firstPage.on('click', function() {
  191. pageIndex = 1;
  192. that.options.first=true;
  193. handles(pageIndex);
  194. })
  195. lastPage.on('click', function() {
  196. pageIndex = totalPages;
  197. that.options.first=true;
  198. handles(pageIndex);
  199. })
  200. $(document).on("click", jumpBtn, function() {
  201. // jumpBtn.on('click', function() {
  202. var jumpNum = parseInt(jumpText.val().replace(/\D/g, ''));
  203. if (jumpNum && jumpNum >= 1 && jumpNum <= totalPages) {
  204. pageIndex = jumpNum;
  205. that.options.first=true;
  206. handles(pageIndex);
  207. jumpText.val(jumpNum);
  208. }
  209. })
  210. //$(document).on("click", lis, function() {
  211. lis.on('click', function() {
  212. that.options.first=true;
  213. pageIndex = $(this).index() + 1;
  214. handles(pageIndex);
  215. })
  216. function handles(pageIndex) {
  217. //debugger;
  218. lis.removeClass('sel-page').eq(pageIndex - 1).addClass('sel-page');
  219. if(totalPages<=1){
  220. firstPage.attr('disabled', true);
  221. prePage.attr('disabled', true);
  222. nextPage.attr('disabled', true);
  223. lastPage.attr('disabled', true) ;
  224. jumpBtn.attr('disabled', true) ;
  225. jumpText.attr('disabled', true) ;
  226. if(that.options.first){
  227. that.options.callback(pageIndex);
  228. }
  229. return false;
  230. }
  231. if (totalPages <= 5) {
  232. if(that.options.first){
  233. that.options.callback(pageIndex);
  234. }
  235. // console.log("222totalPages",totalPages)
  236. return false;
  237. }
  238. if (pageIndex >= 3 && pageIndex <= totalPages - 2) distance = (pageIndex - 3) * liWidth;
  239. if (pageIndex == 2 || pageIndex == 1) distance = 0;
  240. if (pageIndex > totalPages - 2) distance = (totalPages - 5) * liWidth;
  241. pageSelect.css('transform', 'translateX(' + (-distance) + 'px)');
  242. pageIndex == 1 ? firstPage.attr('disabled', true) : firstPage.attr('disabled', false);
  243. pageIndex == 1 ? prePage.attr('disabled', true) : prePage.attr('disabled', false);
  244. pageIndex == totalPages ? lastPage.attr('disabled', true) : lastPage.attr('disabled', false);
  245. pageIndex == totalPages ? nextPage.attr('disabled', true) : nextPage.attr('disabled', false);
  246. if(that.options.first){
  247. that.options.callback(pageIndex);
  248. }
  249. }
  250. //if(that.options.first){
  251. handles(that.options.pageNo); // 初始化页码位置
  252. //}
  253. }
  254. }
  255. $.fn.paging = function(options) {
  256. // console.log($(this));
  257. return new Paging($(this), options);
  258. }
  259. })(jQuery, window, document);
  260. </script>
  261. <script>
  262. //http://layer.layui.com/
  263. $(document).ready(function(){
  264. var tables=$("#tables");
  265. var page=1;
  266. //ajaxDATA(1)
  267. function ajaxDATA(page){
  268. var urls="http://mktm.biqiang8.com/home/goods?firstCid=0&secCid=0&pageNo="+page+"&pageSize=5&exsitIdList="
  269. $.ajax({
  270. type: "GET",
  271. url: urls,
  272. dataType: "json",
  273. success: function(data){
  274. if(data.code==0){
  275. var htmlStr="";
  276. //console.log(data.goods_list);
  277. for(var i=0;i<data.data.goods_list.length;i++){
  278. htmlStr+='<li>'+i+data.data.goods_list[i].title+'<img src="'+data.data.goods_list[i].img_url+'"</li>'
  279. }
  280. $("#tables").html(htmlStr);
  281. }
  282. }
  283. });
  284. }
  285. var setTotalCount = 301;
  286. var fenyeObj={
  287. initPageNo: 1, // 初始页码
  288. totalPages: 1, //总页数
  289. totalCount: '合计' + 0 + '条数据', // 条目总数
  290. slideSpeed: 600, // 缓动速度。单位毫秒
  291. jump: true, //是否支持跳转
  292. first:false, //初始化 是否立即执行回掉
  293. callback: function(page) { // 回调函数
  294. console.log("立11即查询",page);
  295. ajaxDATA(page)
  296. }
  297. }
  298. $('#fenbox').paging(fenyeObj)
  299. $("#saa").on("click",function(){
  300. setTotalCount = 71;
  301. fenyeObj.totalCount = '合计' + setTotalCount + '条数据', // 条目总数;
  302. fenyeObj.totalPages=24;
  303. fenyeObj.first=false;
  304. //console.log("立重置即查询",fenyeObj);
  305. $('#fenbox').paging(fenyeObj)
  306. })
  307. var setTotalCount2 = 31;
  308. var fenyeObj2={
  309. initPageNo: 1, // 初始页码
  310. totalPages: 20, //总页数
  311. totalCount: '合计' + setTotalCount2 + '条数据', // 条目总数
  312. slideSpeed: 600, // 缓动速度。单位毫秒
  313. jump: true, //是否支持跳转
  314. // first:false,
  315. callback: function(page) { // 回调函数
  316. console.log("立即22查询",page);
  317. ajaxDATA(page)
  318. }
  319. }
  320. $('#fenbox2').paging(fenyeObj2)
  321. });
  322. </script>
  323. </body>
  324. </html>

 

 

下拉框

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>信息查询</title>
        <meta name="viewport"   content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"  />

    </head>
    <body>
        
        
        
<style>
html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,span,img,button ,em,i,b{margin:0;padding:0;}
html{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;min-width:320px;font-size:62.5%;}
body{font-family:"微软雅黑",'Helvetica Neue',Helvetica,tahoma,arial,sans-serif;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;line-height:1;font-size:14px;-webkit-touch-callout:none;}
article,aside,dialog,figure,footer,header,hgroup,menu,nav,section{display:block}
dl,li,menu,ol,ul{list-style:none}
address,em,i,th{font-weight:400;font-style:normal}
a{color:#999;display:block;}
a:link,a:visited{color:#999;text-decoration:none;cursor:pointer}
a:hover{cursor:pointer}
a:active,a:focus{outline:0;}
img{width:100%;border:0;vertical-align:middle;-webkit-user-select:none;}
input,select{outline:0}
h1,h2,h3,h4,h5,h6{font-size:100%;font-variant:normal;font-weight:normal;}
button,input[type=button],input[type=tel],input[type=reset],input[type=submit]{line-height:normal!important;-webkit-appearance:none}
::-webkit-input-placeholder{color:#777;}
::input-placeholder{color:#777;}
input:focus::-webkit-input-placeholder{-webkit-transition:.2s;opacity:0;}
input:focus::input-placeholder{transition:.2s;opacity:0;}
.clearfix:after{clear:both;content:".";display:block;height:0;visibility:hidden}
.fl{float:left}
.fr{float:right}
.fl,.fr{display:inline}
.disabled{pointer-events:none;}
.hover{ }
.hover:hover{ cursor: pointer;}        
    
/*    业务css*/
.my_form{ background: #fafafa;
    border: 1px solid #e0e0e0;
    margin-top: 20px; padding: 21px; m }

.my_form .my_form_content{ width: 100%; }
.form_content_submit{ margin: 20px auto; display: block; font-size: 16px; text-align: center;  width: 120px;; height: 44px; line-height: 44px;background: #157fcc; color: #fff; border: 0;;}




.my_form_table{ border: 1px solid #e0e0e0; }
    .flexbox{display:-webkit-box;
display:-moz-box;
display:box;
display:-webkit-flex;
display:-moz-flex;
display:-ms-flexbox;
display:flex;
display:table\9;
}
.flexbox .flex1{
-webkit-box-flex:1;
-moz-box-flex:1;
box-flex:1;
-webkit-flex:1;
-moz-flex:1;
-ms-flex:1;
flex:1;
display:table-cell\9;
}


.selected_icon{ position: relative; width: 100%; height: 100%;}
.selected_icon .check{ position:absolute;background: #157fcc;}
.selected_icon .check.plus{ left: 50%; top: 50%; margin-left: -8px; width: 16px; height: 1px; }
.selected_icon .check.reduce{left: 50%;top: 50%;; margin-top: -8px;; position:absolute;width: 1px; height: 16px; }
.showone.on .check{background: red !important;}
.showone.on .check.reduce{  -webkit-transform:translateY(50%);-moz-transform:translateY(50%);transform:translateY(50%); opacity: 0; -webkit-transition: .3s;-moz-transition: .3s;transition: .3s;;}
.showone{ position: relative;;border-bottom: 1px solid #e0e0e0 ;}
.hideone{ background: #fff; margin:20px 44px;;border: 1px solid #ccc ;}
.hideoneinner { position: relative;; height:44px; line-height: 44px; text-align: center; border-bottom: 1px solid #e0e0e0;}
.hideoneinner div { height:44px; line-height: 44px;border-right: 1px solid #e0e0e0; }
.showone.on:after{position: absolute;
    content: "";
    height: 1px; width: 22px;
    background:#e0e0e0;
    left: 22px; top: 65px;
    z-index: 26;}
 .showone.on:before{ position: absolute;
    content: "";
    height: 22px; width:1px;
    background:#e0e0e0;
    left: 22px; top: 44px;
    z-index: 26;}

.hideoneinner div:last-child{ border-right:0; }
.hideoneinner div:first-child{  font-weight: bold; }
.hideoneinner:last-of-type{  border-bottom: 0;}  
.my_form_table .showone:hover{ background:#f5f5f5 ;}


.filter-disabled {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

.filter-box {
    position: relative; z-index: 92;;
}

.filter-box select {
    display: none;
}

.filter-text {
    height: 100%;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    padding: 0 30px 0 10px;
    background: #fff;
    border: 1px solid #e6e6e6;
}

.filter-text input {
    font-size: 14px;
}

.filter-text .filter-title {
    width: 100%;
    height: 36px;
    line-height: 36px;
    border: 0;
    background-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
    cursor: pointer;
}

.filter-list {
    display: none;
    width: 100%; z-index: 99;
    max-height: 300px;
    background-color: #fff;
    font-size: 14px;
    position: absolute;
    top: 42px;
    left: 0;
    z-index: 99;
    border: 1px solid #e6e6e6;
    overflow: auto;
}

.filter-list li.filter-null a {
    color: #d2d2d2;
}

.filter-list li a {
    display: block;
    padding: 0 10px;
    line-height: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.filter-list li:hover {
    background-color: #f2f2f2;
}

.filter-list li.filter-selected {
    background-color: #5FB878;
}

.filter-list li.filter-selected a{
    display: block;
    color: #fff;
}

.filter-list li.filter-disabled {
    background-color: #fff;
}

.filter-list li.filter-disabled a{
    display: block;
    color: #d2d2d2;
}

.filter-list li.filter-disabled:hover a {
    cursor: not-allowed!important;
    background-color: #fff;
}

.icon {
    position: absolute;
}

.icon-filter-arrow {
     width:0;
    height:0;
    overflow:hidden;
    font-size: 0;     /*是因为, 虽然宽高度为0, 但在IE6下会具有默认的 */
    line-height: 0;  /* 字体大小和行高, 导致盒子呈现被撑开的长矩形 */
    border-width:8px;
    border-style:solid dashed dashed dashed;/*IE6下, 设置余下三条边的border-style为dashed,即可达到透明的效果*/
    border-color:#999 transparent transparent transparent;
    right: 10px;
    top: 13px;
    transition: all .2s;
}

.icon-filter-arrow.filter-show {
    -webkit-transform: rotate(-180deg);
    transform: rotate(-180deg);
}

.filter-list::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.filter-list::-webkit-scrollbar-track {
    background: #fff 
}

.filter-list::-webkit-scrollbar-thumb {
    background: #CBCBCB;
}



#j_searchtask{  background: #666; padding: 10px 20px;}
</style>

        
            <div>  
    
                      <!-- 这里开始 -->
            
            <div class="filter-box filter-box1 fl">
                <div class="filter-text">
                    <input class="filter-title" id="j_qudao"  data-val="" type="text" readonly placeholder="请选择渠道" />
                    <i class="icon icon-filter-arrow"></i>
                </div>
                <select name="filter">
                    <option value="new"  disabled>请选择渠道</option>
                    <option value="11渠道1" >渠道1</option>
                    
                    <option value="22渠道2">渠道2</option>
                    <option value="33渠道3">渠道3</option>
                    
                </select>
            </div>
            
            <!-- 这里结束 -->
                      <!-- 这里开始 -->
            
            <div class="filter-box  filter-box2 fl">
                <div class="filter-text">
                    <input class="filter-title" id="j_qudao2"  data-val="" type="text" readonly placeholder="请选择支付" />
                    <i class="icon icon-filter-arrow"></i>
                </div>
                <select name="filter">
                    <option value="new"  disabled>请选类型</option>
                    <option value="淘宝1" >淘宝</option>
                    
                    <option value="支付宝2">支付宝</option>
                    
                </select>
            </div>
            
            <!-- 这里结束 -->
                      
                      
                      
                   <div class="right fr" class="flex1" id="j_searchtask">查询结果</div>     
                   

        </div>  

    <script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js">    </script>
    
    <script type="text/javascript" >
        
        ;jQuery.fn.selectFilter = function(options) {
    var defaults = {
        callBack: function(res) {}
    };
    var ops = $.extend({}, defaults, options);
    var selectList = $(this).find('select option');
    var that = this;
    var html = '';
    html += '<ul class="filter-list">';
    $(selectList).each(function(idx, item) {
        var val = $(item).val();
        var valText = $(item).html();
        var selected = $(item).attr('selected');
        var disabled = $(item).attr('disabled');
        var isSelected = selected ? 'filter-selected' : '';
        var isDisabled = disabled ? 'filter-disabled' : '';
        if (selected) {
            html += '<li class="' + isSelected + '" data-value="' + val + '"><a title="' + valText + '">' + valText + '</a></li>';
            $(that).find('.filter-title').val(valText);
        } else if (disabled) {
            html += '<li class="' + isDisabled + '" data-value="' + val + '"><a>' + valText + '</a></li>';
        } else {
            html += '<li data-value="' + val + '"><a title="' + valText + '">' + valText + '</a></li>';
        }
        ;
    });
    html += '</ul>';
    $(that).append(html);
    $(that).find('select').hide();
    $(that).on('click', '.filter-text', function() {
        $(that).find('.filter-list').slideToggle(100);
        $(that).find('.filter-list').toggleClass('filter-open');
        $(that).find('.icon-filter-arrow').toggleClass('filter-show');
    });
    $(that).find('.filter-list li').not('.filter-disabled').on('click', function() {
        var val = $(this).data('value');
        var valText = $(this).find('a').html();
        $(that).find('.filter-title').val(valText);
        $(that).find('.icon-filter-arrow').toggleClass('filter-show');
        $(this).addClass('filter-selected').siblings().removeClass('filter-selected');
        $(this).parent().slideToggle(50);
        for (var i = 0; i < selectList.length; i++) {
            var selectVal = selectList.eq(i).val();
            if (val == selectVal) {
                $(that).find('select').val(val);
            }
            ;
        }
        ;ops.callBack(val);
    });
    $(document).on('mousedown', function(e) {
        closeSelect(that, e);
    });
    $(document).on('touchstart', function(e) {
        closeSelect(that, e);
    });
    function closeSelect(that, e) {
        var filter = $(that).find('.filter-list')
          , filterEl = $(that).find('.filter-list')[0];
        var filterBoxEl = $(that)[0];
        var target = e.target;
        if (filterEl !== target && !$.contains(filterEl, target) && !$.contains(filterBoxEl, target)) {
            filter.slideUp(50);
            $(that).find('.filter-list').removeClass('filter-open');
            $(that).find('.icon-filter-arrow').removeClass('filter-show');
        }
        ;
    }
}
;

        
    </script>
        <script type="text/javascript">
            //本小插件支持移动端哦
            
            
        </script>

     <script>
        $(document).ready(function(){
                  
               //下拉组件
            $('.filter-box1').selectFilter({
                callBack : function (val){
                    //返回选择的值
                    //document.getElementById("j_qudao").setAttribute("data-val",val)
                    console.log(val+'-是返回的值')
                }
            });
                   //下拉组件
            $('.filter-box2').selectFilter({
                callBack : function (val){
                    //返回选择的值
                    //document.getElementById("j_qudao").setAttribute("data-val",val)
                    console.log(val+'-是返回的值')
                }
            });  
                  
                  
                      
                      //查询点击
                      $("#j_searchtask").on("click",function(){
                          var qudao_val=$("#j_qudao").attr("data-val");//渠道
                            var qudao_val2=$("#j_qudao2").attr("data-val");//渠道
                                 alert("值-----:"+qudao_val);
                                      alert("值-----:"+qudao_val2);
                            
                          });
                             
                           
                          
                   
 });
    </script>
  
    </body>
</html>

 

水波纹

!function(t, e) {
    "use strict";
    if (void 0 === n || !n)
        var n = function(t) {
            var e = {
                opacity: .5,
                speed: .6,
                bgColor: "#ffffff",
                cursor: !0
            };
            this.option = this.extend(t, e),
            this.isltIE9() || this.init()
        };
    n.prototype = {
        createEle: function(t) {
            return e.createElement(t)
        },
        extend: function(t, e) {
            var n = JSON.parse(JSON.stringify(e));
            for (var i in t)
                n[i] = t[i];
            return n
        },
        isltIE9: function() {
            return !!/MSIE6.0|MSIE7.0|MSIE8.0|MSIE9.0/i.test(navigator.userAgent.split(";")[1].replace(/[ ]/g, ""))
        },
        getPosition: function(t) {
            var e = this.getBoundingClientRect()
              , n = Math.max(e.width, e.height);
            return {
                range: n,
                x: t.clientX - e.left - n / 2,
                y: t.clientY - e.top - n / 2
            }
        },
        loadCss: function() {
            var t = e.scripts
              , n = t[t.length - 1].src
              , i = n.substring(0, n.lastIndexOf("/") + 1);
            e.head.appendChild(function() {
                var t = e.createElement("link");
                return t.href = i + "need/ripple.css",
                t.type = "text/css",
                t.rel = "styleSheet",
                t.id = "ripplecss",
                t
            }())
        },
        addEvent: function() {
            for (var t = this, n = 0; n < this.elements.length; n++)
                "boolean" == typeof t.option.cursor && t.option.cursor && (this.elements[n].style.cursor = "pointer"),
                this.elements[n].addEventListener("mousedown", function(n) {
                    n.stopPropagation();
                    var i = t.getPosition.call(this, n)
                      , o = e.createElement("span");
                    o.className = "ripple",
                    o.style.top = i.y + "px",
                    o.style.left = i.x + "px",
                    o.style.width = i.range + "px",
                    o.style.height = i.range + "px",
                    o.style.animationDuration = t.option.speed + "s",
                    o.style.background = t.option.bgColor,
                    o.style.opacity = t.option.opacity,
                    o.addEventListener("animationend", function() {
                        this.parentNode.removeChild(this)
                    }, !1),
                    this.appendChild(o)
                }, !1)
        }
    },
    n.prototype.init = function() {
        this.loadCss();
        var n = this;
        t.onload = function() {
            n.elements = e.querySelectorAll('[data-ripple="ripple"]'),
            n.addEvent()
        }
    }
    ,
    t.Ripple = n
}(window, document);

css

[data-ripple=ripple] {
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-webkit-user-select: none;
    -ms-user-select: none
}

[data-ripple=ripple] .ripple {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 888;
    background: rgba(255,255,255,.5);
    transform: scale(0);
    animation: ripple .6s 0s linear
}

@keyframes ripple {
    100% {
        opacity: 0;
        transform: scale(2.5)
    }
}

效果

<!DOCTYPE html>
<html lang="en">
<head>
<title>Demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<style type="text/css">
    *{
        margin:0;
        padding: 0;
    }
    div,a,button,h1{
        background: blue;
        height: 50px;
        line-height: 50px;
        color: #fff;
        text-align: center;
        width: 200px;
        margin: 5px;
        border-radius: 5px;
        font-size:14px ;
        font-family: "微软雅黑","Arial Narrow"
    }
    a{
        display: block;
    }
</style>
</head>
<body>
<div data-ripple="ripple">
div标签
</div>
<a data-ripple="ripple">
a标签
</a>
<button data-ripple="ripple">
button标签
</button>
<h1 data-ripple="ripple">
h1标签
</h1>
</body>
</html>
<script src="ripple.min.js" charset="UTF-8"></script>
<script type="text/javascript">
    new Ripple({
        opacity : 0.6,  //水波纹透明度
        speed : 1,      //水波纹扩散速度
        bgColor : "#fff", //水波纹颜色
        cursor : true  //是否显示手型指针
    })
</script>

 

摇一摇 函数

/*
 * Author: Alex Gibson
 * https://github.com/alexgibson/shake.js
 * License: MIT license
 */

(function(global, factory) {
    if (typeof define === 'function' && define.amd) {
        define(function() {
            return factory(global, global.document);
        });
    } else if (typeof module !== 'undefined' && module.exports) {
        module.exports = factory(global, global.document);
    } else {
        global.Shake = factory(global, global.document);
    }
} (typeof window !== 'undefined' ? window : this, function (window, document) {

    'use strict';

    function Shake(options) {
        //feature detect
        this.hasDeviceMotion = 'ondevicemotion' in window;

        this.options = {
            threshold: 15, //default velocity threshold for shake to register
            timeout: 1000 //default interval between events
        };

        if (typeof options === 'object') {
            for (var i in options) {
                if (options.hasOwnProperty(i)) {
                    this.options[i] = options[i];
                }
            }
        }

        //use date to prevent multiple shakes firing
        this.lastTime = new Date();

        //accelerometer values
        this.lastX = null;
        this.lastY = null;
        this.lastZ = null;

        //create custom event
        if (typeof document.CustomEvent === 'function') {
            this.event = new document.CustomEvent('shake', {
                bubbles: true,
                cancelable: true
            });
        } else if (typeof document.createEvent === 'function') {
            this.event = document.createEvent('Event');
            this.event.initEvent('shake', true, true);
        } else {
            return false;
        }
    }

    //reset timer values
    Shake.prototype.reset = function () {
        this.lastTime = new Date();
        this.lastX = null;
        this.lastY = null;
        this.lastZ = null;
    };

    //start listening for devicemotion
    Shake.prototype.start = function () {
        this.reset();
        if (this.hasDeviceMotion) {
            window.addEventListener('devicemotion', this, false);
        }
    };

    //stop listening for devicemotion
    Shake.prototype.stop = function () {
        if (this.hasDeviceMotion) {
            window.removeEventListener('devicemotion', this, false);
        }
        this.reset();
    };

    //calculates if shake did occur
    Shake.prototype.devicemotion = function (e) {
        var current = e.accelerationIncludingGravity;
        var currentTime;
        var timeDifference;
        var deltaX = 0;
        var deltaY = 0;
        var deltaZ = 0;

        if ((this.lastX === null) && (this.lastY === null) && (this.lastZ === null)) {
            this.lastX = current.x;
            this.lastY = current.y;
            this.lastZ = current.z;
            return;
        }

        deltaX = Math.abs(this.lastX - current.x);
        deltaY = Math.abs(this.lastY - current.y);
        deltaZ = Math.abs(this.lastZ - current.z);

        if (((deltaX > this.options.threshold) && (deltaY > this.options.threshold)) || ((deltaX > this.options.threshold) && (deltaZ > this.options.threshold)) || ((deltaY > this.options.threshold) && (deltaZ > this.options.threshold))) {
            //calculate time in milliseconds since last shake registered
            currentTime = new Date();
            timeDifference = currentTime.getTime() - this.lastTime.getTime();

            if (timeDifference > this.options.timeout) {
                window.dispatchEvent(this.event);
                this.lastTime = new Date();
            }
        }

        this.lastX = current.x;
        this.lastY = current.y;
        this.lastZ = current.z;

    };

    //event handler
    Shake.prototype.handleEvent = function (e) {
        if (typeof (this[e.type]) === 'function') {
            return this[e.type](e);
        }
    };

    return Shake;
}));

 

 

其他

 360  科学技术

<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1">
<title>主页</title>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<link rel="stylesheet" href="css/tabris.css">
<link rel="stylesheet" href="css/lib.css">
</head>
<body>
<div class="bg0 pa">
<div class="bg1"></div>
</div>
<div class="hx-box pa">
<ul class="pr">
<li class="hx-k1 pa0">
<span></span>
</li>
<li class="hx-k2 pa0">
<span></span>
</li>
<li class="hx-k3 pa0">
<span></span>
</li>
</ul>
</div>
</body>
</html>
@charset 'utf-8';article,aside,details,figcaption,figure,footer,header,hgroup,hr,main,menu,nav,section,summary {
    display: block
}

hr,img {
    border: 0
}

pre,textarea {
    overflow: auto
}

hr,legend,td,th {
    padding: 0
}

html {
    font-family: sans-serif;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%
}

body {
    color: #333;
    font-size: 1em;
    line-height: 1.42857143;
    font-family: Helvetica,hiragino sans gb,microsoft yahei,微软雅黑,Arial,sans-serif
}

body,form,h1,h2,h3,h4,h5,h6,ol,p,ul {
    margin: 0
}

ol,ul {
    padding-left: 0;
    list-style-type: none
}

h1,h2,h3,h4,h5,h6 {
    font-size: 1em;
    font-weight: 400
}

a {
    text-decoration: none;
    background-color: transparent;
    color: inherit
}

a:active,a:hover {
    outline: 0
}

li {
    list-style: none
}

audio,canvas,progress,video {
    display: inline-block;
    vertical-align: baseline
}

.vm,audio,canvas,iframe,img,svg,video {
    vertical-align: middle
}

audio:not([controls]) {
    display: none;
    height: 0
}

[hidden],template {
    display: none
}

abbr[title] {
    border-bottom: 1px dotted
}

b,optgroup,strong {
    font-weight: 700
}

dfn {
    font-style: italic
}

mark {
    background: #ff0;
    color: #000
}

small {
    font-size: 80%
}

sup {
    top: -.5em
}

sub {
    bottom: -.25em
}

svg:not(:root) {
    overflow: hidden
}

figure {
    margin: 1em 40px
}

hr {
    height: 1px;
    border-top: 1px solid #ccc;
    margin: 1em 0
}

code,kbd,pre,samp {
    font-family: monospace,monospace;
    font-size: 1em
}

button,input,optgroup,select,textarea {
    color: inherit;
    font: inherit;
    margin: 0
}

button {
    overflow: visible
}

button,select {
    text-transform: none
}

button,html input[type=button],input[type=reset],input[type=submit] {
    -webkit-appearance: button;
    cursor: pointer
}

button[disabled],html input[disabled] {
    cursor: default
}

button::-moz-focus-inner,input::-moz-focus-inner {
    border: 0;
    padding: 0
}

input {
    line-height: normal
}

input[type=checkbox],input[type=radio] {
    box-sizing: border-box;
    padding: 0
}

input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button {
    height: auto
}

input[type=search] {
    -webkit-appearance: textfield;
    box-sizing: content-box
}

input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration {
    -webkit-appearance: none
}

fieldset {
    border: 1px solid silver;
    margin: 0 2px;
    padding: .35em .625em .75em
}

legend {
    border: 0
}

textarea {
    resize: vertical
}

table {
    border-collapse: collapse;
    border-spacing: 0
}

::-moz-selection {
    background: #b3d4fc;
    text-shadow: none
}

::selection {
    background: #b3d4fc;
    text-shadow: none
}

.browserupgrade {
    margin: .2em 0;
    background: #ccc;
    color: #000;
    padding: .2em 0
}

.dv {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px
}

.dv.dvv:active,.dv.dvv:focus {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    width: auto
}

.dn {
    display: none
}

.db {
    display: block
}

.fix:after,.fix:before {
    content: " ";
    display: table
}

.fix:after {
    clear: both
}

.fl {
    float: left
}

.fr {
    float: right
}

.pr {
    position: relative
}

.pa,.pa0 {
    position: absolute
}

.pa0 {
    left: 0;
    top: 0
}

.oh {
    overflow: hidden
}

.wh {
    width: 100%;
    height: 100%
}

.bo {
    border: 1px solid red
}

.mg {
    margin-left: auto;
    margin-right: auto
}

.tc {
    text-align: center
}

.wp {
    margin: 0 auto
}

*,:after,:before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box
}

@charset 'utf-8';html {
    width: 100%;
    height: 100%
}

body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-image: -webkit-linear-gradient(90deg,#395ecb 0%,#3657be 35%,#242161 75%,#1a0531 100%);
    background-image: -moz-linear-gradient(90deg,#395ecb 0%,#3657be 35%,#242161 75%,#1a0531 100%);
    background-image: -ms-linear-gradient(90deg,#395ecb 0%,#3657be 35%,#242161 75%,#1a0531 100%);
    background-image: linear-gradient(0deg,#395ecb 0%,#3657be 35%,#242161 75%,#1a0531 100%);
    perspective: 1e3px
}

.bg0 {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: url(../images/bg0.png) no-repeat center center;
    background-size: 150%
}

.bg1 {
    width: 100%;
    height: 100%;
    background: url(../images/bg1.png) no-repeat center center
}

.hx-box {
    top: 50%;
    left: 50%;
    width: 500px;
    height: 500px;
    transform-style: preserve-3d;
    transform: translate(-50%,-50%) rotateY(75deg)
}

.hx-box ul {
    width: 500px;
    height: 500px;
    transform-style: preserve-3d;
    animation: hxz 20s linear infinite
}

@keyframes hxz {
    0% {
        transform: rotateX(0deg)
    }

    100% {
        transform: rotateX(-360deg)
    }
}

.hx-box ul li {
    width: 500px;
    height: 500px;
    border: 4px solid #5ec0ff;
    border-radius: 1e3px
}

.hx-box ul li span {
    display: block;
    width: 100%;
    height: 100%;
    background: url(../images/hx.png) no-repeat center center;
    background-size: 100% 100%;
    animation: hx 4s linear infinite
}

@keyframes hx {
    to {
        transform: rotate(360deg)
    }
}

.hx-k2 {
    transform: rotateX(60deg) rotateZ(60deg)
}

.hx-k3 {
    transform: rotateX(-60deg) rotateZ(-60deg)
}

 

无缝轮播

 

  1. //兼容各种浏览器
  2. $(function(){
  3. var w=630;
  4. var l=0;
  5. var timer=null;
  6. var len=$("ul li").length*2; //复制了一份图片,长度变了。
  7. //复制一份图片,是为了解决第一张图片切换到最后一张或 最后一张切换到第一张时,图片区域会出现空白,用户体验不友好。
  8. // 页面一加载,就把ul定位到追加图片的第一张(本身图片在前,追加图片在后。)
  9. //当图片位置到第一份图片第二张时,马上把图片定位到第二份的第一张,图片位置到最后一张时(第二份最后一张)时,就把图片定位到第一份最后一张,
  10. //这样图片后面或前面还有一张图片,切换时不会留下空白。(关键之处)
  11. //加载后图片排列像这样:1 2 3 4 5 1 2 3 4 5
  12. $("ul").append($("ul").html()).css({'width':len*w, 'left': -len*w/2});
  13. //自动每8秒切换一次
  14. timer=setInterval(init,8000);
  15. function init(){
  16. $(".scroll .next").trigger('click'); //当页面一加载就触发next按钮的点击事件,用trigger的好处是减少重复代码,如果不用,就要把按钮click事件里代码全部复制过来,因为加载的代码和点击next按钮代码和效果相同,所以就用trigger触发执行click里面代码。
  17. }
  18. $("ul li").hover(function(){
  19. clearInterval(timer);
  20. },function(){
  21. timer=setInterval(init,8000);
  22. });
  23. $(".prev").click(function(){
  24. l=parseInt($("ul").css("left"))+w; //这里要转成整数,因为后面带了px单位
  25. showCurrent(l);
  26. });
  27. $(".next").click(function(){
  28. l=parseInt($("ul").css("left"))-w; //这里要转成整数,因为后面带了px单位
  29. showCurrent(l);
  30. });
  31. function showCurrent(l){ //把图片的左右切换封装成一个函数
  32. if($("ul").is(':animated')){ //当ul正在执行动画的过程中,阻止执行其它动作。关键之处,不然图片切换显示不完全,到最后图片空白不显示。
  33. return;
  34. }
  35. $("ul").animate({"left":l},500,function(){
  36. if(l==0){ //当图片位置到第一份图片第二张时,马上把图片定位到第二份的第一张。注意这里的设置的css一定到写在animate动画完成时的执行 //函数里。否则图片只是一瞬间回到第一张,但是没有向右的动画效果。 我在做的时候,用的不是css,而是用animate()定位到第二个第一张,结果切换时,是反方向的运动,一直觉得无论怎样,图片方向都会发生变化 ,弄得花了一天时间才找到原因,所以一定 要用css。
  37. $("ul").css("left",-len*w/2);
  38. }else if(l==(1-len)*w){ //图片位置到最后一张时(第二份最后一张)时,就把图片定位到第一份最后一张。从而显示的是第一份最后一张。
  39. $("ul").css('left',(1-len/2)*w);
  40. }
  41. });
  42. }
  43. });

  

无缝文字上下

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>实现无缝上下滚动</title>
  6. <link href="css/usually.css" type="text/css" rel="stylesheet" />
  7. <script src="js/jquery-1.10.2.min.js"></script>
  8. </head>
  9. <body>
  10. <p class="back"><a href="index.html">返回首页>></a></p>
  11. <style>
  12. .list_top{width:280px; height:100px; overflow:hidden; border:1px solid #ddd; padding:10px;}
  13. .list_ul li{height:30px; line-height:30px;}
  14. </style>
  15. <div class="list_top">
  16. <ul class="clearfix list_ul">
  17. <li>111</li>
  18. <li>222</li>
  19. <li>333</li>
  20. </ul>
  21. </div>
  22. <script>
  23. (function($){
  24. $.fn.extend({
  25. slideFn:function(options){
  26. var defaults = {
  27. isTop:true,//是否
  28. slideTimer:"1000"
  29. };
  30. var options = $.extend(defaults,options);
  31. this.each(function(){
  32. var o = options;
  33. var obj = $(this);
  34. var oUl = obj.find("ul:first");
  35. var oLi = $("li",oUl);
  36. var Timer;
  37. obj.hover(function(){
  38. clearInterval(Timer);
  39. },function(){
  40. Timer = setInterval(function(){
  41. if(o.isTop==true){
  42. slideTop(oUl);
  43. }else{
  44. slideLeft(oUl);
  45. }
  46. }, o.slideTimer )
  47. }).trigger("mouseleave");
  48. var slideTop = function(box){
  49. var oLiHeight = box.find("li:first").height();
  50. box.animate({"marginTop":-oLiHeight+"px"},800,function(){
  51. box.css("marginTop",0).find("li:first").appendTo(box);
  52. })
  53. };//上滚
  54. var slideLeft = function(box2){
  55. box2.css("width",((oLi.width())*(oLi.length))+"px");
  56. var oLiWidth = box2.find("li:first").width();
  57. box2.animate({"marginLeft":-oLiWidth+"px"},800,function(){
  58. box2.css("marginLeft",0).find("li:first").appendTo(box2);
  59. })
  60. };//左滚
  61. })
  62. }
  63. })
  64. })(jQuery);
  65. //实现无缝上下滚动 无缝左右滚动--------------------------------------------------------------
  66. $(".list_top").slideFn();
  67. </script>
  68. </body>
  69. </html>

  

转载于:https://www.cnblogs.com/surfaces/p/9168400.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/97177
推荐阅读
相关标签
  

闽ICP备14008679号