robiveli / jpopup Goto Github PK
View Code? Open in Web Editor NEWSimple lightweight (<2kB) javascript popup modal plugin
Home Page: https://robiveli.github.io/jpopup/
License: MIT License
Simple lightweight (<2kB) javascript popup modal plugin
Home Page: https://robiveli.github.io/jpopup/
License: MIT License
Hello,
How can I create multiple instances of jPopup on the same page? whenever I create var popup = new JPopup()
it opens all the other pop ups on the page.
Thanks!
If the overlay have a lot of text, after create it I try to use Jquery animate after but doesnt work like:
var jPopupDemo = new jPopup({
content: $('.worlds-popup').html()
});
$('html, body').velocity({
scrollTop: $('.JPopup '+"#"+$(this).attr('data-goto')).offset().top
}, 2000);
...so I extend the Jpopup like this code...but doesnt work too..
` open: function open(params) {
jPopup(params);
},
goTo: function goTo(id) {
console.log('custom '+id);
console.log($(".jPopup #"+id).offset().top);
var $container = $(".jPopup");
var $scrollTo = $(".jPopup #"+id);
$container.animate({scrollTop: $scrollTo.offset().top - $container.offset().top + $container.scrollTop(), scrollLeft: 0},300);
/*$('.JPopup #testID').animate({
scrollTop: $(".jPopup #"+id).offset().top
}, 2000);*/
}`
Any ideas?
I tried including this in a Nuxt (vue.js) project, that has server side rendering, with this basic example:
<template>
<div>
<h1>Hi World</h1>
</div>
</template>
<script>
import jPopup from 'jPopup';
export default {
data () {
return {
popup: null
}
},
mounted () {
// eslint-disable-next-line new-cap
this.popup = new jPopup({ // initialize jPopup
content: '<p>Lorem Ipsum...</p>',
transition: 'fade',
onOpen: ($popupElement) => {
console.log('popup open');
},
onClose: ($popupElement) => {
console.log('popup closed');
}
});
this.popup.open();
}
}
</script>
<style lang="scss" scoped>
</style>
However, it will crash the whole app:
document is not defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.