Coder Social home page Coder Social logo

infinitegrid-instahead's Introduction

infiniteGrid-instahead

egjs 의 Infinite Grid 를 확장하여 인스타그램 스타일로 스크롤에 따라 헤더가 갱신되는 모듈

usage

    var ig = new eg.InfiniteGridInstaHead("#grid", {
        count : 60,
        defaultGroupKey : 1,
        headHolder : $('#instahead')
    }).on({
        "append" : function(e) {
            var gk = this.getGroupKeys();
            var lastGk = gk[gk.length-1];
            lastGk++;
            ig.append(template(data.getItems(lastGk)), lastGk);
        },
        "prepend" : function(e) {
            var firstGk = this.getGroupKeys()[0];
            firstGk--;
            if(firstGk >= 0) {
                ig.prepend(template(data.getItems(firstGk)), firstGk);
            }
        },
        "layoutComplete" : function(e) {
            $grid.css("visibility", "visible");
        }
    });

위와 같이 초기 생성시에 headHolder 에 헤더가 상단에 고정된 엘리먼트를 옵션으로 전달. 또한 마크업 구조에 <header class="real_header">, <header class="fake_header"> 가 추가되어야 한다.

demo

open instahead-demo.html

infinitegrid-instahead's People

Watchers

sangwook kim avatar

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.