Giter VIP home page Giter VIP logo

sticky's Introduction

Sticky

Sayfada belirli bir scroll'a gelindiğinde sayfaya yapışan elementler.

Kullanımı

sticky fonksiyonu bir obje parametresi bekler.

Bu parametreler;

attribute tür açıklama varsayılan değer
breakpoint string hangi çözünürlükte sticky olacak mobile tablet desktop
id string sticky olacak elementin id'si -
scrollPosition integer hangi scroll pozisyonunda sticky olacağı -
className string sticky olacak elemente eklenen class sticky
hidden boolean aşağı inerken element gizlensin mi değeri false

Örnek;

sticky({
  breakpoint      : "mobile",
  id              : "header",
  scrollPosition  : 450,
  className       : "yapiskan",
  hidden          : true
})

Yukarıdaki kod, header id'sine sahip HTML elementine mobil çözünürlükte, 450px scroll'dan sonra yapiskan sınıfını ekler. Aşağı yönde scroll yapıldığında header'a sınıf eklemek fakat yukarı scroll edildiğinde yapiskan sınıfını ekler.


  • breakpoint değerine verilecek değerler mobile, tablet, desktop olarak verilmiştir ama kod tarafı ilk harfine bakar. Yani "m" yada "mahmut" yazılması yine mobil olarak çalışacaktır.

  • className değerine bir değer girilmezse sticky sınıfı varsayılan olarak eklenir.

  • hidden değerine bir değer girilmezse element belirlenen px'den sonra sınıf adı direkt eklenir; yukarı yada aşağı scroll edilmesini dinlemez.


NOT: Proje sadece JavaScript içerir. Scroll dinlenir ve belirlenen px'de belirlenen elemente class eklenir. Herhangi bir CSS içermez. CSS kısmını proje ihtiyacına göre sizin yazmanız gerekir.

sticky's People

Contributors

omergulcicek avatar

Watchers

 avatar  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.