基于jq, jquery.easie.js 开发面向对象通栏焦点图组件

<!--banner begin-->
<div class="banner min_width" id="one" style="">
<span class="foucL fouc"></span>
 <ul>
   <li style="background: url(./images/banner.jpg) no-repeat center top; height:454px;"><a href=""></a></li>
   <li style="background: url(./images/banner1.jpg) no-repeat center top; height:454px;"><a href=""></a></li>
   <li style="background: url(./images/banner2.jpg) no-repeat center top; height:454px;"><a href=""></a></li>
 </ul>
 <span class="foucR fouc"></span>

    <div class="foucdocs"></div>
</div>
<!--banner end-->
<script>
    $(function(){
        Scroll({
            dome:$(‘#one‘),
            next:$(‘.foucL‘),
            pre:$(‘.foucR‘)
        });
    })
</script>
;
(function ($, window, document, undefined) {
    function scroll() {
        this.num = 0;
        this.obj = this;
        this.dome = null;
        this.dome_ul = null;
        this.dome_li_lent = null;
        this.full_wit = null;
        this.timer = null;
        this.next = null;
        this.pre = null;
        this.settings = {
            times: 2000,
            way_annimate: ‘ease-out‘,
        };

    }

    scroll.prototype.init = function (opt) {
        var This = this;
        var pos_left = null;
        this.options = $.extend({}, this.settings, opt)
        this.dome = this.options.dome;
        this.dome_ul = this.dome.find(‘ul‘);
        this.dome_ul.append(this.dome_ul.find(‘li:first‘).clone())
        this.dome_li_lent = this.dome_ul.find(‘li‘).length;

        for (var b = 0; b < this.dome_li_lent; b++) {
            this.dome.find(‘.foucdocs‘).append(‘<span></span>‘);
        }

        this.dome.find(‘.foucdocs span‘).eq(0).addClass(‘focus_on‘);
        this.next = this.dome.find(this.options.next);
        this.pre = this.dome.find(this.options.pre);
        this.getwidth();
        this.timer = setInterval(gos, This.options.times);
        $(window).resize(function () {
            This.getwidth();
        })
        this.dome.hover(function () {
            This.next.show();
            This.pre.show();
            clearInterval(This.timer);
        }, function () {
            This.next.hide();
            This.pre.hide();
            This.timer = setInterval(gos, This.options.times);
        })

        function gos() {
            This.num++;
            if (This.num > (This.dome_li_lent - 1)) {
                This.num = 0;
            }
            This.dome.find(‘.foucdocs span‘).eq(This.num).addClass(‘focus_on‘).siblings(‘span‘).removeClass(‘focus_on‘)
            pos_left = (This.full_wit * This.num);
            This.dome_ul.stop().animate({left: -pos_left + ‘px‘}, This.options.way_annimate);
        }
        this.dome.find(‘.foucdocs span‘).mouseover(function () {
            This.num=$(this).index();
            pos_left = (This.full_wit * This.num);
            This.dome_ul.stop().animate({left: -pos_left + ‘px‘}, This.options.way_annimate);
            $(this).addClass(‘focus_on‘).siblings(‘span‘).removeClass(‘focus_on‘);
        })
        this.next.click(function () {
            gos();
        })
        this.pre.click(function () {
            This.num--;
            if (This.num < 0) {
                This.num = This.dome_li_lent - 1;
                console.log(This.num)
            }
            This.dome.find(‘.foucdocs span‘).eq(This.num).addClass(‘focus_on‘).siblings(‘span‘).removeClass(‘focus_on‘);a
            pos_left = (This.full_wit * This.num);
            This.dome_ul.stop().animate({left: -pos_left + ‘px‘}, This.options.way_annimate);
        })
    }

    scroll.prototype.getwidth = function () {
        this.full_wit = $(window).width();
        this.dome_ul.css({
            width: this.full_wit * this.dome_li_lent + ‘px‘,
        })
        this.dome_ul.find(‘li‘).css({
            width: this.full_wit + ‘px‘,
        })
    }

    window.Scroll = function (opt) {
        var litscoll = new scroll();
        litscoll.init(opt);

    }
})(jQuery, window, document);
git仓库地址:https://github.com/XINYUHAI77/jquery_full
时间: 2024-11-06 21:36:10

基于jq, jquery.easie.js 开发面向对象通栏焦点图组件的相关文章

一个酷炫的,基于HTML5,Jquery和Css的全屏焦点图特效,兼容各种浏览器

基于HTML5和CSS的焦点图特效,梅花图案的背景很有中国特色,而且还会动哦,效果超炫,推荐下载! 演示图 html代码 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/199

基于 Koa平台Node.js开发的KoaHub.js的控制器,模型,帮助方法自动加载

koahub-loader koahub-loader是基于 Koa平台Node.js开发的KoaHub.js的koahub-loader控制器,模型,帮助方法自动加载 koahub loader Installation $ npm install koahub-loader Use with koa // 1.model loader var model = loader([ {      root: './app/model',      suffix: '.model.js' }, { 

基于js全屏动画焦点图幻灯片

今天给大家分享一款基于js全屏动画焦点图幻灯片.这款焦点图内的内容以动画形式出现和消失.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class="slideshow" id="slideshow"> <ol class="slides"> <li class="current"> <div class="description"&g

基于jQuery的网站首页宽屏焦点图幻灯片

今天给大家分享一款基于jQuery的网站首页宽屏焦点图幻灯片.这款焦点图适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗.效果图如下: 在线预览   源码下载 实现的代码. html代码: <!-- index-focus begin --> <div class="sliderWrap"> <section class="banner-TAL"> <div class

(转)heX——基于 HTML5 和 Node.JS 开发桌面应用

本文转载自:http://techblog.youdao.com/?p=685 简介:heX,一个允许你采用前端技术(HTML,CSS,JavaScript)开发桌面应用软件的跨平台解决方案.是你开发桌面应用的一种新的选择,意在解决传统桌面应用开发中繁琐的UI和交互开发工作,使其变的简单而高效.特别适合重UI,重交互的桌面应用软件. 欢迎关注http://hex.youdao.com  或微博 @youdao_hex. 一.项目背景 二.用heX开发桌面应用的优势 三.如何用heX开始一个桌面应

基于 Koa平台Node.js开发的KoaHub.js连接打印机的代码

最近好多小伙伴都在做微信商城的项目,那就给大家分享一个基于 Koa.js 平台的 Node.js web 开发的框架连接微信易联云打印机接口的代码,供大家学习.koahub-yilianyun 微信易联云打印机接口 koahub-yilianyun易联云打印机node接口 Installation $ npm install koahub-yilianyunUse with co-request var printer = require('koahub-yilianyun');var resu

基于 Koa平台Node.js开发的KoaHub.js获取/设置会话功能代码

koa-session2 Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb with Babel koa-session2     Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb with Babel If you are not using bab

基于webpack的Vue.js开发环境快速搭建

1. 安装node node下载地址 2. 安装淘宝 NPM 镜像命令地址 3. 安装vue # 全局安装 vue-cli cnpm install -g vue-cli 4. 创建一个基于 "webpack" 模板的新项目 # 创建一个项目文件夹,在文件夹下shift + 右键,选择在此处打开cmd vue init webpack 5. 安装依赖 # 安装依赖 cnpm install #安装完毕后,在项目路径下多出了依赖包. 6. 运行项目 #运行项目 运行成功,默认8080 端

基于 Koa平台Node.js开发的KoaHub.js的静态服务器重写和索引代码

koa-static-server Static file serving middleware for koa with directory, rewrite and index support koa-static-server static file serving middleware for koa with directory, rewrite and index support Installation $ npm install koa-static-server API var