Najlepszy samouczek Przykłady UI jQuery - klasa konwersji (Przełącz klasa) W 2024 r. W tym samouczku możesz dowiedzieć się .switchClass () Demo,
Gdy zmienia się styl animacji w zestawie dopasowanych elementów, dodawać i usuwać każdy element określonej klasy.
Aby uzyskać więcej informacji na temat .switchClass()
Szczegóły dotyczące metod można znaleźć w dokumentacji API .switchClass () .
Kliknij przycisk, aby wyświetlić podgląd efektów.
<! DOCTYPE html> <Html lang = "pl"> <Head> <Meta charset = "utf-8"> <Title> jQuery UI Effects - .switchClass () Demo </ title> <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <Script src = "// code.jquery.com/jquery-1.9.1.js"> </ script> <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script> <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css"> <Style> .toggler {width: 500px; height: 200px; position: relative;} #button {padding: .5em 1em; text-decoration: none;} #effect {position: relative;} .newClass {width: 240 piks; padding: 1 em; letter-spacing: 0; font-size: 1.2em; margin: 0;} .anotherNewClass {text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em;} </ Style> <Script> $ (Function () { $ ( "#button") .Kliknij (Function () { $ ( ".newClass") .switchClass ( "NewClass", "anotherNewClass", 1000); $ ( ".anotherNewClass") .switchClass ( "AnotherNewClass", "newClass", 1000); return false; }); }); </ Script> </ Head> <Body> <Div class = "wahacz"> <Div id = "efekt" class = "newClass ui-corner-all"> Etiam libero neque, luctus a, eleifend, gdzie indziej niesklasyfikowane, sempre AT, Lorem. Sed pede. </ Div> </ Div> <a href="#" id="button" class="ui-state-default ui-corner-all"> prowadzone efekty </a> </ Body> </ Html>