- Where Developers Learn, Share, & Build Careers
I have a script that is at $ (window). Resize () needs to hide the divs in a list. However, because I am using the old OS, my browser does not change in realtime again, instead it detects a trail where this size will change, and then open to go, this size changes. Type, the script below only removes a device from the list instead of all those conflicts. How can I fix this?
jQuery:
$ (window). Resize (function () {movePivots ();}); Function Slobient () {var last_pivot = $ ("ul li: last"); If ($ ("# container"). Width () - $ ("ul"). Width () & lt; = 0} {last_pivot.remove (); } Else {}} CSS:
# container {float: left; Width: 50%; Minimum width: 450px; Max-width: 900 pixels; Height: 1000px; Background-color: #EE; } #nav {float: left; Background color: #ddd; Minimum width: 450px; Max-width: 900 pixels; Width: 100%; } Ul {float: left; Margin: 0; Padding: 0; List style: none; Background color: #ccc; }
Use a while loop:
$ (Window). Resize (function () {movePivots ();}); Function Slobient () {var last_pivot = $ ("ul li: last"); While ($ ("# container"). Width () - $ ("ul"). Width () & lt; = 0} {last_pivot.remove (); Last_pivot = $ ("ul li: final"); }}
Comments
Post a Comment