• 0

jPopup, new jquery function I wrote


Question

I wrote my own popup function since none of the currently existing functions fullfilled the needs of my projects.

https://github.com/seahorsepip/jPopup

 

It supports IE7+* and is fully responsive. It's dynamic, all popup properties can be changed even after the popup has been opened.

 

Example popup code:

 

var example = new jPopup({
	title: "<h2>Hello world!</h2>",
	content: "<p>Sudo make me a sandwich?</p>",
	buttons: [{
		text: "Sure!",
		value: true
	}, {
		text: "Nope",
		value: false
	}],
	draggable: true
});
example.open(function(r) {
	alert("Value of clicked button: "+r);
});

 

A webpage and complete documentation are in the making. 

 

Let me know what you think about it and if you have any suggestions or ideas :D

 

 

*Yes I even made sure it works on very old useless browsers :shiftyninja:

Link to comment
https://www.neowin.net/forum/topic/1285784-jpopup-new-jquery-function-i-wrote/
Share on other sites

Recommended Posts

  • 0
  On 31/01/2016 at 15:23, Seahorsepip said:

I use less css mostly but if a project uses something else I'm also fine with it. I used css in this case since it requires no compiling for the user, it's ready to be used.

 

It might be a good idea to add a scss or less file and a css file so it can be used directly without any trouble(css) and developers can modify/learn from the scss/less file.

 

I'm currently looking into optimizing the js code, it can de reduced quite a bit I hope. Also There's a bug for IE8, buttons can have a "class" property that causes errors, to fix this I'll change it to buttonClass.

Expand  

How interested are you in using an asset manager?

  • 0
  On 01/02/2016 at 22:17, Mur said:

How interested are you in using an asset manager?

Expand  

Never used one, I used mostly less css in projects since it gave me the ability to have css variable which I could change on the fly with js.

 

Personally I don't see the need for an asset manager in this case, the files aren't big enough and it's our goal to keep them that way :p

 

I'm currently working on a resize option and width/height/minWidth/minHeight/maxWidth/maxHeight options.

  • 0
  On 01/02/2016 at 23:20, Seahorsepip said:

Never used one, I used mostly less css in projects since it gave me the ability to have css variable which I could change on the fly with js.

 

Personally I don't see the need for an asset manager in this case, the files aren't big enough and it's our goal to keep them that way :p

 

I'm currently working on a resize option and width/height/minWidth/minHeight/maxWidth/maxHeight options.

Expand  

It's not necessarily about the size of the file as much as it is the organization of certain things. Albeit functions or certain parameters, I use it in my personal site design in a way of partials as seen on github; the design is still a major wip but you can easily see how it would be a lot easier to sort things in this particular case. I've got that project followed and actively watching it, whenever I see an opportunity to hop in and help out I will. As you start to get more familiar with GitHub I can give you a bit of an insight of how I (personally) do project management so that you can scale up projects pretty easy in the future.

 

Already started using jPopup on my personal site, still have to tweak it a bit to do exactly as I want it to do but it's a really, really solid project and I love it. Well done.

  • 0
  On 01/02/2016 at 23:57, Mur said:

It's not necessarily about the size of the file as much as it is the organization of certain things. Albeit functions or certain parameters, I use it in my personal site design in a way of partials as seen on github; the design is still a major wip but you can easily see how it would be a lot easier to sort things in this particular case. I've got that project followed and actively watching it, whenever I see an opportunity to hop in and help out I will. As you start to get more familiar with GitHub I can give you a bit of an insight of how I (personally) do project management so that you can scale up projects pretty easy in the future.

 

Already started using jPopup on my personal site, still have to tweak it a bit to do exactly as I want it to do but it's a really, really solid project and I love it. Well done.

Expand  

Tweak it? What did you change? My goal in jPopup is to make it as versatile as possible.

  • 0
  On 02/02/2016 at 00:14, Seahorsepip said:

Tweak it? What did you change? My goal in jPopup is to make it as versatile as possible.

Expand  

Not to the design (sorry should have specified) it'll be used to display all of the case-study articles I public regarding the various development jobs I have.

 

I don't like the way the unordered list is presented, the library thus far has been perfect.

 

vjP3cvF.png

  • 0
  On 02/02/2016 at 00:17, Mur said:

Not to the design (sorry should have specified) it'll be used to display all of the case-study articles I public regarding the various development jobs I have.

 

I don't like the way the unordered list is presented, the library thus far has been perfect.

 

vjP3cvF.png

Expand  

Unordered lists and other html content are not styled, only the basic html elements are styled. Any additional styling can be done by adding additional css to the default css file of the website(not jpopup).

 

Example:

var neowin = new jPopup({
	title: "<h1>Neowin case studies</h1>",
	content: "<p class=\"hello\">Hello world</p>",
	buttons: [
		text: "Close"
	]
});
neowin.addClass("popup_case_studies").open();

Then you can add case studies specific css to the popup:

.popup_case_studies .popup ul li {
	/*Do whatever you want for case studies list items */
}

Also if you want to add a click handler to the hello world text you can do the following:

neowin.popupContent().children(".hello").click(function() {
	//Do something
});

So yeah I need to make a proper documentation with examples.

 

And I'm considering to add check and radiobox styling and also list styling.

This topic is now closed to further replies.
  • Posts

    • Darwin Mach Kernel/ BSD. Which is both open source.
    • You mean BSD. The UNIX kernel is not open source.
    • I have been on Linux Mint full-time since Jan 2019. while there is a learning curve, it's worth it if you can make the switch, which I can. I mainly browse web, play some games (generally Lutris(Windows games), or through emulators (MAME/Mesen/Flycast etc) etc), and use a small amount of Windows programs (Foobar2000/7-zip/WinRAR/ImgBurn etc) etc. it's nice to dodge the bloat/BS of Windows as you can really feel Linux is all around faster, especially certain things. p.s. recently I enabled NTSync for games since Linux Mint recently offered the 6.14 kernel, which has NTSync support (it's not enabled by default though but you can enable it temporarily for your current boot of the OS through 'sudo modprobe ntsync')
    • A rotten article full of handwaving of anti-consumer practices. Aside from the fact that no, not even close to every piece of major software collects information about its users, ethical developers make such telemetry opt-in and allow it to be completely disabled. To use KDE Plasma as an example, you're shown a greeter upon first boot that gives users the option to send the developers telemetry, with the default being off and 'off' actually meaning off. Windows 10 has never offered that capability - only a promise that Microsoft will slurp up less of your data if you spend time tweaking 50 different privacy settings. There is still absolutely no way to completely opt out of sending Microsoft telemetry in any version of Windows 10 (or 11, naturally). Even using group policy in Enterprise editions only allows you to reduce telemetry to the bare minimum. Home-focused editions don't even get that option. Articles like this dismissing user privacy concerns as "FUD" are a part of the reason Microsoft felt confident enough to go so much further with Windows 11. I guess you get what you deserve in that respect. Personally, I finally made the move to Linux after 15 years or so of dabbling with it, but never really considering a permanent switch. Enjoy your bright, shiny Windows future. You asked for it, after all.
  • Recent Achievements

    • First Post
      smileyhead earned a badge
      First Post
    • One Month Later
      K V earned a badge
      One Month Later
    • Week One Done
      K V earned a badge
      Week One Done
    • Dedicated
      CarlosABC earned a badge
      Dedicated
    • One Month Later
      solidox earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      638
    2. 2
      ATLien_0
      240
    3. 3
      Xenon
      172
    4. 4
      neufuse
      155
    5. 5
      +FloatingFatMan
      122
  • Tell a friend

    Love Neowin? Tell a friend!