@umutyaldiz/hopejs

0.0.14 • Public • Published

@umutyaldiz/hopejs

FrontEnd Project Builder

Installation

npm install @umutyaldiz/hopejs

Components

import { Page, Slider, LazyLoad, isInViewport, Scroll, Tracker } from '@umutyaldiz/hopejs';

Page //extended Class

class Name extends Page {
	constructor(options) {
		super(options);
	}
	Init() {
		super.Load();
	}
}

Slider

import Swiper, { Navigation, Pagination } from 'swiper'; //dependence

new Slider({
	'plugin':Swiper,
	'modules': [Navigation, Pagination],
    'paginationTypes': {
            'type2': {
                pagination: {
                    el: '.swiper-pagination',
                    renderBullet: function (index, className) {
                        return '<span data-slider-index="' + index + '" class="' + className + '"></span>';
                    }
                }
            }
    },
    'onFuncTypes':{
            'type2': {
                on: {
                init: function (swiper) {
                    const bullets = swiper.pagination.bullets;
                    for (let i = 0, length = bullets.length; i < length; i++) {
                    bullets[i].addEventListener("mouseover", () => {
                        swiper.slideTo(bullets[i].getAttribute('data-slider-index'));
                    });
                    }
                }
                }
            }
    }
});
this.sliders.Init();

LazyLoad

import Blazy from 'blazy'; //dependence

const lazyLoad = new LazyLoad();
lazyLoad.Init({
	plugin: Blazy,
	selector: '[data-src]:not(.swiper-lazy)',
	success: function (element) { }
});

isInViewport

isInViewport(document.querySelector('.html-element'));

Scroll

const scroll = new Scroll();
scroll.On((properties) => { // return {x,y,direction}
scroll.ScrollEvents(properties, [customfunction1,customfunction2]);
});

Tracker

const tracker = new Tracker();
tracker.ElementViewTrack(document.querySelectorAll('.html-element'));    
tracker.DataLayerPush({    
    event:"event1",    
    title:"title"    
});

Demo Page

Github Repo Demo

FrontEnd-Architecture DEMO

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.141latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.141
0.0.130
0.0.120
0.0.110
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @umutyaldiz/hopejs

Weekly Downloads

1

Version

0.0.14

License

MIT

Unpacked Size

12 kB

Total Files

11

Last publish

Collaborators

  • umutyaldiz