Resize Function

Hallo alle zusammen! Ich würde gerne meine Dropdown Tabs "resetten", sobald man die Ansicht Mobile View verlässt. Mein Code funktioniert leider nicht.

Der hier verwendete Code

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <style> body{ font-size:100px; text-align:center; } .green{ background:rgba(2,255,2,0.7); color:black; } .black{ background:rgba(0,0,0,0.7); color:white; } </style> <body class="black"> Resize Mich </body> <script> $(window).resize(function() { los(); }); function los(){ if($(window).width()>460){ $('body').html(' Klasse green aktive'); $("body").addClass('green').removeClass('black'); }else{ $('body').html(' Klasse black aktive'); $("body").addClass('black').removeClass('green'); } } los(); </script>

Add Comment

* Required information
1000
Drag & drop images (max 3)
Powered by Commentics

Comments

No comments yet. Be the first!