{"id":3545,"date":"2022-06-03T11:30:48","date_gmt":"2022-06-03T11:30:48","guid":{"rendered":"https:\/\/rengga.dev\/blog\/?p=3545"},"modified":"2023-06-12T14:30:46","modified_gmt":"2023-06-12T14:30:46","slug":"js-tutorial-hover-slider-dark-light-with-bootstrap-css-unicons-css","status":"publish","type":"post","link":"https:\/\/rengga.dev\/blog\/js-tutorial-hover-slider-dark-light-with-bootstrap-css-unicons-css\/","title":{"rendered":"JS Tutorial &#8211; Hover Slider (Dark\/Light) with bootstrap.css, unicons.css"},"content":{"rendered":"<p><span style=\"color: #ef3207;\"><a style=\"color: #ef3207;\" href=\"https:\/\/rengga.dev\/\" target=\"_blank\" rel=\"noopener\"><strong>Rengga Dev<\/strong><\/a> <\/span>&#8211; JS Tutorial &#8211; jQuery slider with hover effect and dark\/light themes.<\/p>\n<p><iframe style=\"width: 100%;\" title=\"JS Tutorial - Hover Slider (Dark\/Light) with bootstrap.css, unicons.css\" src=\"https:\/\/codepen.io\/renggagumilar\/embed\/YzLmBYL?default-tab=result&amp;theme-id=dark\" height=\"800\" frameborder=\"no\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><br \/>\nSee the Pen <a href=\"https:\/\/codepen.io\/renggagumilar\/pen\/YzLmBYL\"><br \/>\nJS Tutorial &#8211; Hover Slider (Dark\/Light) with bootstrap.css, unicons.css<\/a> by Rengga Gumilar (<a href=\"https:\/\/codepen.io\/renggagumilar\">@renggagumilar<\/a>)<br \/>\non <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<br \/>\n<\/iframe><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\r\n\/* Please \u2764 this if you like it! *\/\r\n\r\n\r\n\r\n(function($) { \"use strict\";\r\n    \r\n    \/\/Page cursors\r\n\r\n    document.getElementsByTagName(\"body\")[0].addEventListener(\"mousemove\", function(n) {\r\n        t.style.left = n.clientX + \"px\", \r\n        t.style.top = n.clientY + \"px\", \r\n        e.style.left = n.clientX + \"px\", \r\n        e.style.top = n.clientY + \"px\", \r\n        i.style.left = n.clientX + \"px\", \r\n        i.style.top = n.clientY + \"px\"\r\n    });\r\n    var t = document.getElementById(\"cursor\"),\r\n        e = document.getElementById(\"cursor2\"),\r\n        i = document.getElementById(\"cursor3\");\r\n    function n(t) {\r\n        e.classList.add(\"hover\"), i.classList.add(\"hover\")\r\n    }\r\n    function s(t) {\r\n        e.classList.remove(\"hover\"), i.classList.remove(\"hover\")\r\n    }\r\n    s();\r\n    for (var r = document.querySelectorAll(\".hover-target\"), a = r.length - 1; a &gt;= 0; a--) {\r\n        o(r[a])\r\n    }\r\n    function o(t) {\r\n        t.addEventListener(\"mouseover\", n), t.addEventListener(\"mouseout\", s)\r\n    }\r\n\r\n\r\n    \/\/Switch light\/dark\r\n    \r\n    $(\".switch\").on('click', function () {\r\n        if ($(\"body\").hasClass(\"light\")) {\r\n            $(\"body\").removeClass(\"light\");\r\n            $(\".switch\").removeClass(\"switched\");\r\n        }\r\n        else {\r\n            $(\"body\").addClass(\"light\");\r\n            $(\".switch\").addClass(\"switched\");\r\n        }\r\n    });\r\n    \r\n    $(document).ready(function() {\t\r\n        \r\n        \/* Hero Case study images *\/\t\t\t\r\n        \r\n        $('.slide-buttons li:nth-child(1)').on('mouseenter', function() {\r\n            $('.slide-buttons li.active').removeClass('active');\r\n            $('.hero-center-section.show').removeClass(\"show\");\r\n            $('.hero-center-section:nth-child(1)').addClass(\"show\");\r\n            $('.slide-buttons li:nth-child(1)').addClass('active');\r\n        })\r\n        $('.slide-buttons li:nth-child(2)').on('mouseenter', function() {\r\n            $('.slide-buttons li.active').removeClass('active');\r\n            $('.hero-center-section.show').removeClass(\"show\");\r\n            $('.hero-center-section:nth-child(2)').addClass(\"show\");\r\n            $('.slide-buttons li:nth-child(2)').addClass('active');\r\n        })\r\n        $('.slide-buttons li:nth-child(3)').on('mouseenter', function() {\r\n            $('.slide-buttons li.active').removeClass('active');\r\n            $('.hero-center-section.show').removeClass(\"show\");\r\n            $('.hero-center-section:nth-child(3)').addClass(\"show\");\r\n            $('.slide-buttons li:nth-child(3)').addClass('active');\r\n        })\r\n        $('.slide-buttons li:nth-child(4)').on('mouseenter', function() {\r\n            $('.slide-buttons li.active').removeClass('active');\r\n            $('.hero-center-section.show').removeClass(\"show\");\r\n            $('.hero-center-section:nth-child(4)').addClass(\"show\");\r\n            $('.slide-buttons li:nth-child(4)').addClass('active');\r\n        })\r\n        $('.slide-buttons li:nth-child(5)').on('mouseenter', function() {\r\n            $('.slide-buttons li.active').removeClass('active');\r\n            $('.hero-center-section.show').removeClass(\"show\");\r\n            $('.hero-center-section:nth-child(5)').addClass(\"show\");\r\n            $('.slide-buttons li:nth-child(5)').addClass('active');\r\n        })\r\n        $('.slide-buttons li:nth-child(6)').on('mouseenter', function() {\r\n            $('.slide-buttons li.active').removeClass('active');\r\n            $('.hero-center-section.show').removeClass(\"show\");\r\n            $('.hero-center-section:nth-child(6)').addClass(\"show\");\r\n            $('.slide-buttons li:nth-child(6)').addClass('active');\r\n        })\r\n        $('.slide-buttons li:nth-child(1)').trigger('mouseenter')   \r\n        \r\n    });\r\n    \r\n})(jQuery);<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rengga Dev &#8211; JS Tutorial &#8211; jQuery slider with hover effect and <a class=\"read-more\" href=\"https:\/\/rengga.dev\/blog\/js-tutorial-hover-slider-dark-light-with-bootstrap-css-unicons-css\/\" title=\"JS Tutorial &#8211; Hover Slider (Dark\/Light) with bootstrap.css, unicons.css\" itemprop=\"url\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":3546,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,12],"tags":[363,264,263,103,227],"newstopic":[],"class_list":{"0":"post-3545","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript","8":"category-web-development","9":"tag-hover-slider","10":"tag-javascript-tutorial","11":"tag-js-tutorial","12":"tag-web-design","13":"tag-web-designer"},"_links":{"self":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/3545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/comments?post=3545"}],"version-history":[{"count":2,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/3545\/revisions"}],"predecessor-version":[{"id":3548,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/3545\/revisions\/3548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/media\/3546"}],"wp:attachment":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/media?parent=3545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/categories?post=3545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/tags?post=3545"},{"taxonomy":"newstopic","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/newstopic?post=3545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}