7/26/2023 0 Comments Jquery responsive resizeI will have to see the window dimensions. I guess, I will try this with the $(window).resize event instead. My original code is working however, that handler will be triggered infinitely and I think it slows the rendering of my table and sometime the pagination won't work. However, on mobile and tablet-p modes, I want that column to be shown as a detail and not as a column. On desktop and tablet-l modes it is doing what I want: hide the age column. See the next screenshots and you will see why I don't want I tried with the dr-controll class and assigned it to the "age" column, which is the one I actually want to hide or show according to the view, but it is not working as I want, see: Regarding the class logic, I already tried to set the age column to "mobile" and "table-p", but that's not the result I want. one() handler will be executed only one however, I need to show/hide the column each time that the user enters or leaves the responsive view, which on my case it would be the mobile and tablet-p modes the other modes will show the full table. Any idea on how to achieve this? Is there perhaps a better way of achieving what I want?īest Regarding your answer: as far as I know the. So, basically what I need is to temporary disable the responsive-resize event. * Adding and removing a css class -> It keeps running It will run only once, so, it won't be re-enabled. * Appending a boolean flag to the e.data -> It keeps running It says always: undefinedįrom this Stackoverflow answer:, I tried everything: * Adding a global variable, but it seems that inside the event handler that global variable can't be read. * Stop event propagation with: e.stopPropagation(). I really need those two lines since the idea is to hide the age column while on a desktop or a landscape tablet and show it on the other devices. So, this two lines trigger the event again and that's why it will be kept running infinitely. Basically this two:ĭata_lumns( ).visible( true ) ĭata_lumns( ).visible( false ) I saw that this behavior will stop if I comment the lines: 24 and 27 from the jsFiddle. Press: Run, open the iframe in a new tab, press F12 and put the break-point. If you debug the Fiddle using the Developer Tool from Mozilla or Chrome and put a break-point inside the responsive-resize handler (line 34 in the js iFrame), then you will see that that event will be infinitely triggered. The row should be shown only on mobiles and portrait tablets. $('.menu-button').click(function() else if ($menu.is(':hidden') || $menu.Right now, I'm working on a responsive Datatable, where I want to hide a column while showing the table on a desktop and on a landscape table. I was wondering a way to detect if resize() was scaling up r down in this case when scaling down I can hide() menu and when scaling up I can show() menu. I can then hide the menu again when scaled less than 767px but this causes a flash of the menu as it is hidden. this then causes the new menu to show, when the browser window is scaled down again less than 767 px, instead of having the default be hidden. to fix this I added code to show the menu once the browser resizes. The menu is hidden when the browser window is less than 767 px, so this button appears which allows it to be toggled on and off, this works except the only problem is when I resize the window bigger again, the menu is gone, if slide toggled has set it to display none. I have this code which shows/hides a menu when a button is cicked $('#main-menu ul').slideToggle()
0 Comments
Leave a Reply. |