/** * Created by lance on 2016-04-17. */ //处理缩略图 function DrawImage(hotimg) { $(hotimg).jqthumb({ width: '100%',//宽度 height: '142px',//高度 //position : { y: '50%', x: '50%'},//从图片的中间开始产生缩略图 zoom: '1',//缩放比例 method: 'auto'//提交方法,用于不同的浏览器环境,默认为‘auto’ }); } //调用客服按钮 $(function () { $('.selectFlag').bind('click', function () { var myModal = $('#myModal'); myModal.modal('show'); }); var wflag = false; $('.weixin').bind('click', function () { var self = $(this); if (!wflag) { wflag = true; self.find('span').css('display', 'block'); } else { wflag = false; self.find('span').css('display', 'none'); } }); new Swiper('#nav_sec', { slidesPerView: 'auto', hashNavigation: { watchState: true } }); $('.select_list span').bind('click', function () { var self = $(this), aSelf = $('.select_list span.active'); aSelf.removeClass('active'); self.addClass('active'); }); $('.confirmOk').bind('click', function () { var aSelf = $('.select_list span.active'), itemId = aSelf.attr('itemid'), wurl = $('#url').val() + itemId; top.location = wurl; }); $('.index_select').change(function () { var self = $(this); window.location.href = self.val();//页面跳转并传参 }); $('.product_more').bind('click', function () { console.log('start'); var page = parseInt($('#page').val()) + 1, total = parseInt($('#total').val()), pageURI = $('#pageURI').val() + '&p=' + page, myModal = $('#myModal'); console.log(page); console.log(total); if (page <= total) { console.log('start2'); $.ajax({ url: pageURI, cache: false, type: 'GET', dataType: 'json', success: function (ajaxData) { //处理调用成功事件 if (ajaxData.status) { var content = ajaxData.data.content; $('.more_list').append(content); $('#page').val((page)); var pageView = $('#pageview').val(); switch (pageView) { case 'video': $('.vimg').jqthumb({ width: '100%', height: '100%' }); break; case 'album': imgsdata= imgsdata.concat(ajaxData.data.list); console.log(imgsdata); break; } } else { $('.more_other').removeClass('hide').html(ajaxData.message); return false; } } }); } else { //增加提示代码 $('.more_other').removeClass('hide').html('没有更多数据'); return false; } }); var flag = 1; $('.lcbody,#leftnav').click(function () { if (flag == 1) { //展开 $('body').addClass('open'); $('#leftnav').show(); flag = 0; } else { //闭合 $('body').removeClass('open'); var t = setTimeout("$('#leftnav').hide()", 1); flag = 1; } }); $('.go-top').bind('click', function () { $(window).scrollTop(0); }); if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { var wow = new WOW( { animateClass: 'animated', offset: 100, callback: function (box) { console.log("WOW: animating <" + box.tagName.toLowerCase() + ">") } } ); wow.init(); } $('.nav_sec').affix(); $('.fixed_nav').affix(); }); //中的onmouseover 改成 onclick; //]]> function selectpic(id) { var imgsrc = id.src; $('#product_pic').attr('src', imgsrc); } function checkorder() { var username = $('#username').val(); var idcode = $('#idcode').val(); var telphone = $('#telphone').val(); var code = $('#code').val(); var flag = true, msg = ''; if (username === "") { msg += '请输入姓名
'; flag = false; } if (telphone === "") { msg += '请输入联系电话
'; flag = false; } if (code === "") { msg += '请输入验证码
'; flag = false; } if (!flag) { var myModal = $('#myModal'); myModal.find('.modal-header').removeClass('hide'); myModal.find('.modal-footer').removeClass('hide'); myModal.find('.btn-primary').addClass('hide'); myModal.find('.modal-body').html(msg); myModal.modal('show'); myModal.find('.btn-default').html('确定'); return false; } return true; } var goSwipe = function (obj, direction) { var self = $('.' + obj), selfObj, tabKey, nextTabKey, nextObj, data_count = parseInt(self.attr('data_count')); selfObj = self.find('.active'); //当前显示的对象 tabKey = parseInt(selfObj.attr('tab_key')); if (direction == 'next') { if (tabKey > 0) { nextTabKey = tabKey - 1; } else { nextTabKey = data_count; } } else { if (tabKey < data_count) { nextTabKey = tabKey + 1; } else { nextTabKey = 0; } } nextObj = $('#' + obj + nextTabKey); //下一个需要显示的对象 console.log('nextTabKey:' + nextTabKey); console.log('tabKey:' + tabKey); selfObj.addClass('hide').removeClass('active'); //去掉当前tab的选中及增加隐藏 nextObj.removeClass('hide').addClass('active'); //给下一个tab去掉隐藏,增加选中 };