This time I will share jQuery Plugin and tutorial about Windows-like Moveable Windows In jQuery – jDoor, hope it will help you in programming stack.
jDoor is a tiny jQuery plugin to create customizable and moveable dialog windows on the page.
These windows behave almost like Microsoft Windows. They can get or lose the focus and you can move them with your mouse around the screen.
How to use it:
1. Load the main script and core stylesheet in the document.
1 |
< link rel = "stylesheet" href = "/path/to/jdoor/jdoor.css" /> |
2 |
< script src = "/path/to/cdn/jquery.slim.min.js" ></ script > |
3 |
< script src = "/path/to/jdoor/jdoor.js" ></ script > |
2. Create a moveable window on the screen using the following parameters:
- targetscreenId: The jQuery-selector for the target screen. E.g. ‘#mytargetscreen’, ‘div’
- windowId: The (html) name and id of the window. Used for further processing of the end user.
- x: Left position of the window on the targetscreen (in pixels). Use ‘center’ to center it horizontally.
- y: Top position of the window on the targetscreen (in pixels). Use ‘center’ to center it vertically.
- width: Width of the window in pixels. If the content overflows the window, a scrollbar will be shown. Use ‘auto’, ‘dynamic’ or ‘dyn’ to use the content’s width. You can also use a negative number to set the “max-width” instead of the “width”.
- height: Height of the window in pixels.
- title: Text to be shown in the top bar of the window.
- content: Content of the window (HTML).
2 |
$( '#targetContainer' ).jdCreateWindow( 'my_window_id' , 100,100, 'dyn' , -50, "A window" , "This is <br />just<br /> a<br /> window. <div style='width:40px; height:40px; background-color: #FA0;'></div>" ); |
3. Embed a Youtube video into the moveable Window.
2 |
$( '#targetContainer' )jdCreateYoutubeWindow( 'youtube_window' , 100,150, 200, 'dyn' , "Youtube Window" , "8Ltr_IkvKmc" ); |
4. Show & hide the moveable Window.
5 |
$(targetscreenId).jdHideAllWindows(); |
5. Replace the content of a window.
1 |
$(windowId).jdHTML(html); |
6. Override the default styles of the window.
02 |
border : 2px solid #FC2C25 ; |
03 |
background-color : #222222 ; |
05 |
font-family : 'Roboto' ; |
10 |
background-color : #FC2C25 ; |
15 |
background-color : #911 ; |