javascript - Adding navigation button below a Slider -
is I have a very simple slider that use jQuery and I want to add navigation under the slider. It can be dot boxes, anything is fine.
Please help me in it. The code below is
$ (document) .ready (function () {$ ('. Sp')) first (). AddClass ('active'); $ ('Sp' $ ('active'). Show (); $ ('# button-next') Click (function () {$ ('. Active'). RemoveClass ('active'). AddClass "the oldest active '); if ($ (' oldest active '). (' last child ')) {$ (" Sp ")) before (). AddClass (" active ");} else {$ ( "KoldActive ') next (). AddClass (' active ');} $ (' Puranaaktiv '). Nikalenkls (' Puranaaktiv '); $ ('. Sp '). FadeOut (); $ (' ( '' active ''). $ ( "# button-back"). click (function () {$ ( '. Active'). RemoveClass ( "active"). AddClass ( 'Puraneaktiv'); if ($ ( 'oldest active '). (': First-escape Rcha ')) {$ ('. Sp '). Last (). AddClass ( "active");} else {$ (' Puranaaktiv '). (' 'Active' ')); $ (' Old Active ') RemoveClass ('oldactive'); $ ('.sp'). Fade (); $ ('active') .Fedine ();});}); & Lt; / Script & gt; & Lt; Div id = "slider-cover" & gt; & Lt; Div id = "slider" & gt; & Lt; Div class = "sp" style = "background: blue;" & Gt; Akjdfalfkdj & lt; / Div & gt; & Lt; Div class = "sp" style = "background: yellow;" & Gt; Akjdfautlfkdkjkhkj & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div id = "button-past" & gt; Previous & lt; / Div & gt; & Lt; Div id = "button-next" & gt; Next & lt; / Div & gt; & Lt; Div id = "" nav "& gt;
" post-text "itemprop =" div ") .length; var i = 1; while (n> i) {$ (document.body) .append ( $ ("& Lt; div>" + i + "")); i ++;}
Comments
Post a Comment