@@ -132,7 +132,7 @@ <h4 class="align-center font-open-sans-normal-italic">jAlert is really easy, and
132132 < div class ="row features ">
133133 < div class ="span4 ">
134134 < h3 > < i class ="fa fa-expand "> </ i > Plenty-o Sizes</ h3 >
135- < p > Completely responsive (just under full width on small screens), but for tablets and desktops, you have a lot of control over how large the alert is.</ p >
135+ < p > Completely responsive (just under full width on small screens), but for tablets and desktops, you have a lot of control over how large the alert is. Enhanced tablet support with optimized button sizing for better touch interaction. </ p >
136136 < a href ='# ' class ='btn btn-primary jsize '> xsm</ a >
137137 < a href ='# ' class ='btn btn-primary jsize '> sm</ a >
138138 < a href ='# ' class ='btn btn-primary jsize '> md</ a >
@@ -275,6 +275,10 @@ <h4><i class="fa fa-images"></i> Slideshow</h4>
275275 < a href ='# ' class ='jslideshow-no-controls btn btn-primary '> No Controls</ a >
276276 < a href ='# ' class ='jslideshow-keyboard btn btn-primary '> Keyboard Only</ a >
277277 < a href ='# ' class ='jslideshow-dots-arrows btn btn-primary '> Dots + Arrows</ a >
278+ < br > < br >
279+ < h4 > < i class ="fa fa-expand "> </ i > Dynamic Resize</ h4 >
280+ < a href ='# ' class ='jresize btn btn-primary '> Manual Resize</ a >
281+ < a href ='# ' class ='jresize-auto btn btn-primary '> Auto-Resize on Change</ a >
278282
279283 < script >
280284 // Image alerts
@@ -459,6 +463,60 @@ <h4><i class="fa fa-images"></i> Slideshow</h4>
459463 'size' : 'lg'
460464 } ) ;
461465 </ script >
466+
467+ <!-- Resize Demo Scripts -->
468+ < script >
469+ // Manual Resize Demo
470+ $ ( '.jresize' ) . on ( 'click' , function ( e ) {
471+ e . preventDefault ( ) ;
472+ var modalContent = 'Short content.' ;
473+ $ . jAlert ( {
474+ title : 'Manual Resize Demo' ,
475+ content : '<div id="manual-resize-content">' + modalContent + '</div>' ,
476+ size : 'sm' ,
477+ theme : 'blue' ,
478+ onOpen : function ( alert ) {
479+ window . currentManualResizeAlert = alert . data ( 'jAlert' ) ;
480+ // Auto-change content after 3 seconds and trigger resize
481+ setTimeout ( function ( ) {
482+ $ ( '#manual-resize-content' ) . text ( 'This is a much longer content that should trigger a resize when we call autoResize() manually.' ) ;
483+ window . currentManualResizeAlert . autoResize ( ) ;
484+ } , 3000 ) ;
485+ }
486+ } ) ;
487+ } ) ;
488+
489+ // Auto-Resize on Change Demo
490+ $ ( '.jresize-auto' ) . on ( 'click' , function ( e ) {
491+ e . preventDefault ( ) ;
492+ var modalContent = 'Small content.' ;
493+ $ . jAlert ( {
494+ title : 'Auto-Resize on Change Demo' ,
495+ content : '<div id="auto-resize-content">' + modalContent + '</div>' ,
496+ size : 'sm' ,
497+ theme : 'green' ,
498+ autoResizeOnContentChange : true ,
499+ onOpen : function ( alert ) {
500+ // Change content multiple times with varying sizes
501+ setTimeout ( function ( ) {
502+ $ ( '#auto-resize-content' ) . html ( '<h3>HUGE Content!</h3><p>This is a much larger content with multiple paragraphs and lots of text to demonstrate how the modal automatically resizes to fit the content. The autoResizeOnContentChange option is enabled, so the modal will automatically adjust its size whenever the content changes.</p><p>This should make the modal quite large to accommodate all this text.</p>' ) ;
503+ } , 2000 ) ;
504+
505+ setTimeout ( function ( ) {
506+ $ ( '#auto-resize-content' ) . text ( 'Medium content with some additional text to make it a reasonable size.' ) ;
507+ } , 5000 ) ;
508+
509+ setTimeout ( function ( ) {
510+ $ ( '#auto-resize-content' ) . html ( '<h4>Large Content</h4><p>This is a large content block with a heading and some paragraphs. It should be bigger than medium but smaller than huge.</p><ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul>' ) ;
511+ } , 8000 ) ;
512+
513+ setTimeout ( function ( ) {
514+ $ ( '#auto-resize-content' ) . text ( 'Back to small content.' ) ;
515+ } , 11000 ) ;
516+ }
517+ } ) ;
518+ } ) ;
519+ </ script >
462520 < h3 style ="margin-top:20px "> < i class ="fa fa-adjust "> </ i > Blurred Background</ h3 >
463521 Popup an alert and blur all the background elements:< br > < br >
464522 < a href ='# ' class ='jblur btn btn-primary '> Image</ a >
@@ -1306,6 +1364,142 @@ <h4>Utility Function</h4>
13061364 autoAdvanceInterval: 2000,
13071365 loop: true
13081366});</ code > </ pre >
1367+
1368+ < h3 class ="font-bree-serif "> Dynamic Resize Functionality</ h3 >
1369+ < p > jAlert now supports dynamic resizing of modals to fit content changes. This is particularly useful for modals with dynamic content that changes after the modal is opened.</ p >
1370+
1371+ < h4 > Basic Usage</ h4 >
1372+ < pre > < code > // Manual resize to fit content
1373+ $.jAlert({
1374+ title: 'Dynamic Content',
1375+ content: '<div id="dynamic-content">Short content</div>'
1376+ });
1377+
1378+ // Later, after content changes
1379+ $('#dynamic-content').text('Much longer content that needs more space');
1380+ $('.jAlert').autoResize();
1381+
1382+ // Or use the global function
1383+ $.autoResize();</ code > </ pre >
1384+
1385+ < h4 > Auto-Resize on Content Changes</ h4 >
1386+ < pre > < code > // Enable automatic resizing when content changes
1387+ $.jAlert({
1388+ title: 'Auto-Resize Demo',
1389+ content: '<div id="auto-content">Initial content</div>',
1390+ autoResizeOnContentChange: true
1391+ });
1392+
1393+ // Content changes will automatically trigger resize
1394+ $('#auto-content').html('<h3>New Content</h3><p>This will automatically resize the modal</p>');</ code > </ pre >
1395+
1396+ < h4 > Resize Options</ h4 >
1397+ < table class ="table table-bordered ">
1398+ < thead >
1399+ < tr >
1400+ < th > < strong > Option</ strong > </ th >
1401+ < th > < strong > Type</ strong > </ th >
1402+ < th > < strong > Default</ strong > </ th >
1403+ < th > < strong > Description</ strong > </ th >
1404+ </ tr >
1405+ </ thead >
1406+ < tbody >
1407+ < tr >
1408+ < td > autoResizeOnContentChange</ td >
1409+ < td > boolean</ td >
1410+ < td > false</ td >
1411+ < td > Automatically resize the modal when content changes (uses MutationObserver)</ td >
1412+ </ tr >
1413+ </ tbody >
1414+ </ table >
1415+
1416+ < h4 > Resize Methods</ h4 >
1417+ < table class ="table table-bordered ">
1418+ < thead >
1419+ < tr >
1420+ < th > < strong > Method</ strong > </ th >
1421+ < th > < strong > Sample</ strong > </ th >
1422+ < th > < strong > Params</ strong > </ th >
1423+ < th > < strong > Description</ strong > </ th >
1424+ </ tr >
1425+ </ thead >
1426+ < tbody >
1427+ < tr >
1428+ < td > autoResize</ td >
1429+ < td > $('.jAlert').autoResize();< br > OR< br > $.autoResize();</ td >
1430+ < td > none</ td >
1431+ < td > Automatically resize the modal to fit its current content (height only)</ td >
1432+ </ tr >
1433+ < tr >
1434+ < td > resizeToFit</ td >
1435+ < td > $('.jAlert').resizeToFit();< br > OR< br > $.resizeToFit();</ td >
1436+ < td > none</ td >
1437+ < td > Alias for autoResize() - resize modal to fit content</ td >
1438+ </ tr >
1439+ < tr >
1440+ < td > resizeModal</ td >
1441+ < td > $('.jAlert').resizeModal(null, 300);< br > OR< br > $.resizeModal(300);</ td >
1442+ < td > height (optional)</ td >
1443+ < td > Resize modal to specific height (in pixels) or auto-fit if no height provided</ td >
1444+ </ tr >
1445+ </ tbody >
1446+ </ table >
1447+
1448+ < h4 > Advanced Usage</ h4 >
1449+ < pre > < code > // Get the alert instance and call methods
1450+ const alert = $.jAlert('current');
1451+ if (alert) {
1452+ alert.autoResize();
1453+ alert.resizeModal(null, 400); // Set specific height
1454+ }
1455+
1456+ // Resize after AJAX content loads
1457+ $.jAlert({
1458+ ajax: 'dynamic-content.html',
1459+ onOpen: function(alert) {
1460+ // Content is loaded, now resize to fit
1461+ alert.autoResize();
1462+ }
1463+ });
1464+
1465+ // Resize after dynamic content changes
1466+ $('#dynamic-content').load('new-content.html', function() {
1467+ $('.jAlert').autoResize();
1468+ });</ code > </ pre >
1469+
1470+ < h4 > Notes</ h4 >
1471+ < ul >
1472+ < li > Resize functionality only adjusts < strong > height</ strong > - width is controlled by the size option (sm, md, lg, etc.)</ li >
1473+ < li > Auto-resize uses MutationObserver to detect content changes</ li >
1474+ < li > Manual resize methods should be called after content changes are complete</ li >
1475+ < li > Resize works with all content types: text, HTML, AJAX-loaded content, etc.</ li >
1476+ </ ul >
1477+
1478+ < h3 class ="font-bree-serif "> Enhanced Reliability & Performance</ h3 >
1479+ < p > jAlert v5.0.4 includes significant improvements to error handling and API consistency for better reliability in production environments.</ p >
1480+
1481+ < h4 > Enhanced Error Handling</ h4 >
1482+ < ul >
1483+ < li > < strong > Defensive Programming</ strong > : Added robust guards to prevent undefined access errors in async scenarios</ li >
1484+ < li > < strong > AJAX Error Handling</ strong > : Improved error handling for AJAX content loading with proper type checking</ li >
1485+ < li > < strong > Async Safety</ strong > : Better handling of race conditions and DOM removal timing</ li >
1486+ < li > < strong > Memory Management</ strong > : Proper cleanup of MutationObserver instances and event handlers</ li >
1487+ </ ul >
1488+
1489+ < h4 > API Consistency</ h4 >
1490+ < ul >
1491+ < li > < strong > Standardized Access</ strong > : Consistent use of < code > .jAlert()</ code > method for API access</ li >
1492+ < li > < strong > Method Chaining</ strong > : All methods return < code > this</ code > for better chaining support</ li >
1493+ < li > < strong > Better Encapsulation</ strong > : Improved error prevention through proper method access patterns</ li >
1494+ < li > < strong > Backward Compatibility</ strong > : All changes maintain 100% compatibility with existing code</ li >
1495+ </ ul >
1496+
1497+ < h4 > Mobile & Tablet Enhancements</ h4 >
1498+ < ul >
1499+ < li > < strong > Optimized Button Sizing</ strong > : Better touch-friendly button dimensions for tablet devices (451px - 1024px)</ li >
1500+ < li > < strong > Improved Layout</ strong > : Enhanced responsive design for button containers and spacing</ li >
1501+ < li > < strong > Touch Interaction</ strong > : Better padding and font sizes for improved user experience on touch devices</ li >
1502+ </ ul >
13091503 </ section >
13101504 </ div > <!--end documentation-content-->
13111505
0 commit comments