- <script>
- //Init
- $( ".ramka" ).dialog({ autoOpen: false,
- closeText: "zamknij",
- hide: 'fade',
- show: 'fade',
- modal: true,
- resizable: false
- });
- //Closing window on click
- $('body').on('click','.ui-widget-overlay', function() {
- $('.ui-dialog').filter(function () {
- return $(this).css("display") === "block";
- }).find('.ui-dialog-content').dialog('close');
- });
- //Closing dialog on click
- $( ".ramka" ).click(function() {$( this ).dialog( "close" );
- });
- function widthHeight(szerokosc,wysokosc) {$( ".ramka" ).dialog( "option", "height", wysokosc );
- $( ".ramka" ).dialog( "option", "width", szerokosc );
- };
- </script>
And I want to put it into a .js file and include it on my sites. Sadly, I don't really have access to the <HEAD> section, because the site is powered by a lousy CMS. When I have this code on a page, the dialog works perfectly (ofcourse I have a div and an opening function in there) but when I put this in a .js file (without the <script> tags) and include in on the site by <script src=""></script> my div isn't hidden and the dialog doesn't work. How do I properly make this code into a library? Or maybe it's just Java isn't like PHP include and I have to put it all in a function and execute it (which I don't think coz including JQuery and JQUI works fine)?