{"id":33532,"date":"2023-02-09T13:11:56","date_gmt":"2023-02-09T07:41:56","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/"},"modified":"2023-02-09T13:11:56","modified_gmt":"2023-02-09T07:41:56","slug":"solved-how-can-i-scroll-the-page-with-img-tag-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/","title":{"rendered":"[Solved] How can i scroll the page with img tag [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-17401982\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"17401982\" data-parentid=\"17401675\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<pre class=\"lang-js prettyprint-override\"><code>$(window).load(function () {\n  (function ($) {\n    jQuery.fn.extend({\n      slimScroll: function (o) {\n        var ops = o;\n        \/\/do it for every element that matches selector\n        this.each(function () {\n          var isOverPanel,\n            isOverBar,\n            isDragg,\n            queueHide,\n            barHeight,\n            divS = \"&lt;div&gt;&lt;\/div&gt;\",\n            minBarHeight = 30,\n            wheelStep = 30,\n            o = ops || {},\n            cwidth = o.width || \"auto\",\n            cheight = o.height || \"250px\",\n            size = o.size || \"7px\",\n            color = o.color || \"#000\",\n            position = o.position || \"right\",\n            opacity = o.opacity || 0.4,\n            alwaysVisible = o.alwaysVisible === true;\n\n          \/\/used in event handlers and for better minification\n          var me = $(this);\n\n          \/\/wrap content\n          var wrapper = $(divS)\n            .css({\n              position: \"relative\",\n              overflow: \"hidden\",\n              width: cwidth,\n              height: cheight,\n            })\n            .attr({ class: \"slimScrollDiv\" });\n\n          \/\/update style for the div\n          me.css({\n            overflow: \"hidden\",\n            width: cwidth,\n            height: cheight,\n          });\n\n          \/\/create scrollbar rail\n          var rail = $(divS).css({\n            width: \"15px\",\n            height: \"100%\",\n            position: \"absolute\",\n            top: 0,\n          });\n\n          \/\/create scrollbar\n          var bar = $(divS)\n            .attr({\n              class: \"slimScrollBar \",\n              style: \"border-radius: \" + size,\n            })\n            .css({\n              background: color,\n              width: size,\n              position: \"absolute\",\n              top: 0,\n              opacity: opacity,\n              display: alwaysVisible ? \"block\" : \"none\",\n              BorderRadius: size,\n              MozBorderRadius: size,\n              WebkitBorderRadius: size,\n              zIndex: 99,\n            });\n\n          \/\/set position\n          var posCss = position == \"right\" ? { right: \"1px\" } : { left: \"1px\" };\n          rail.css(posCss);\n          bar.css(posCss);\n\n          \/\/wrap it\n          me.wrap(wrapper);\n\n          \/\/append to parent div\n          me.parent().append(bar);\n          me.parent().append(rail);\n\n          \/\/make it draggable\n          bar.draggable({\n            axis: \"y\",\n            containment: \"parent\",\n            start: function () {\n              isDragg = true;\n            },\n            stop: function () {\n              isDragg = false;\n              hideBar();\n            },\n            drag: function (e) {\n              \/\/scroll content\n              scrollContent(0, $(this).position().top, false);\n            },\n          });\n\n          \/\/on rail over\n          rail.hover(\n            function () {\n              showBar();\n            },\n            function () {\n              hideBar();\n            }\n          );\n\n          \/\/on bar over\n          bar.hover(\n            function () {\n              isOverBar = true;\n            },\n            function () {\n              isOverBar = false;\n            }\n          );\n\n          \/\/show on parent mouseover\n          me.hover(\n            function () {\n              isOverPanel = true;\n              showBar();\n              hideBar();\n            },\n            function () {\n              isOverPanel = false;\n              hideBar();\n            }\n          );\n\n          var _onWheel = function (e) {\n            \/\/use mouse wheel only when mouse is over\n            if (!isOverPanel) {\n              return;\n            }\n\n            var e = e || window.event;\n\n            var delta = 0;\n            if (e.wheelDelta) {\n              delta = -e.wheelDelta \/ 120;\n            }\n            if (e.detail) {\n              delta = e.detail \/ 3;\n            }\n\n            \/\/scroll content\n            scrollContent(0, delta, true);\n\n            \/\/stop window scroll\n            if (e.preventDefault) {\n              e.preventDefault();\n            }\n            e.returnValue = false;\n          };\n\n          var scrollContent = function (x, y, isWheel) {\n            var delta = y;\n\n            if (isWheel) {\n              \/\/move bar with mouse wheel\n              delta = bar.position().top + y * wheelStep;\n\n              \/\/move bar, make sure it doesn't go out\n              delta = Math.max(delta, 0);\n              var maxTop = me.outerHeight() - bar.outerHeight();\n              delta = Math.min(delta, maxTop);\n\n              \/\/scroll the scrollbar\n              bar.css({ top: delta + \"px\" });\n            }\n\n            \/\/calculate actual scroll amount\n            percentScroll =\n              parseInt(bar.position().top) \/\n              (me.outerHeight() - bar.outerHeight());\n            delta = percentScroll * (me[0].scrollHeight - me.outerHeight());\n\n            \/\/scroll content\n            me.scrollTop(delta);\n\n            \/\/ensure bar is visible\n            showBar();\n          };\n\n          var attachWheel = function () {\n            if (window.addEventListener) {\n              this.addEventListener(\"DOMMouseScroll\", _onWheel, false);\n              this.addEventListener(\"mousewheel\", _onWheel, false);\n            } else {\n              document.attachEvent(\"onmousewheel\", _onWheel);\n            }\n          };\n\n          \/\/attach scroll events\n          attachWheel();\n\n          var getBarHeight = function () {\n            \/\/calculate scrollbar height and make sure it is not too small\n            barHeight = Math.max(\n              (me.outerHeight() \/ me[0].scrollHeight) * me.outerHeight(),\n              minBarHeight\n            );\n            bar.css({ height: barHeight + \"px\" });\n          };\n\n          \/\/set up initial height\n          getBarHeight();\n\n          var showBar = function () {\n            \/\/recalculate bar height\n            getBarHeight();\n            clearTimeout(queueHide);\n\n            \/\/show only when required\n            if (barHeight &gt;= me.outerHeight()) {\n              return;\n            }\n            bar.fadeIn(\"fast\");\n          };\n\n          var hideBar = function () {\n            \/\/only hide when options allow it\n            if (!alwaysVisible) {\n              queueHide = setTimeout(function () {\n                if (!isOverBar &amp;&amp; !isDragg) {\n                  bar.fadeOut(\"slow\");\n                }\n              }, 1000);\n            }\n          };\n        });\n\n        \/\/maintain chainability\n        return this;\n      },\n    });\n\n    jQuery.fn.extend({\n      slimscroll: jQuery.fn.slimScroll,\n    });\n  })(jQuery);\n\n  \/\/invalid name call\n  $(\"#Id\").slimscroll({\n    color: \"#aaa\",\n    size: \"6px\",\n    width: \"392px\",\n    height: \"525px\",\n  });\n});\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How can i scroll the page with img tag [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] $(window).load(function () { (function ($) { jQuery.fn.extend({ slimScroll: function (o) { var ops = o; \/\/do it for every element that matches selector this.each(function () { var isOverPanel, isOverBar, isDragg, queueHide, barHeight, divS = &#8220;&lt;div&gt;&lt;\/div&gt;&#8221;, minBarHeight = 30, wheelStep = 30, o = ops || {}, cwidth = o.width || &#8220;auto&#8221;, cheight = o.height &#8230; <a title=\"[Solved] How can i scroll the page with img tag [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\" aria-label=\"More on [Solved] How can i scroll the page with img tag [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[464,346,333],"class_list":["post-33532","post","type-post","status-publish","format-standard","hentry","category-solved","tag-css","tag-html","tag-javascript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How can i scroll the page with img tag [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How can i scroll the page with img tag [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] $(window).load(function () { (function ($) { jQuery.fn.extend({ slimScroll: function (o) { var ops = o; \/\/do it for every element that matches selector this.each(function () { var isOverPanel, isOverBar, isDragg, queueHide, barHeight, divS = &quot;&lt;div&gt;&lt;\/div&gt;&quot;, minBarHeight = 30, wheelStep = 30, o = ops || {}, cwidth = o.width || &quot;auto&quot;, cheight = o.height ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-09T07:41:56+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How can i scroll the page with img tag [closed]\",\"datePublished\":\"2023-02-09T07:41:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\"},\"wordCount\":24,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"css\",\"html\",\"javascript\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\",\"name\":\"[Solved] How can i scroll the page with img tag [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2023-02-09T07:41:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How can i scroll the page with img tag [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How can i scroll the page with img tag [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How can i scroll the page with img tag [closed] - JassWeb","og_description":"[ad_1] $(window).load(function () { (function ($) { jQuery.fn.extend({ slimScroll: function (o) { var ops = o; \/\/do it for every element that matches selector this.each(function () { var isOverPanel, isOverBar, isDragg, queueHide, barHeight, divS = \"&lt;div&gt;&lt;\/div&gt;\", minBarHeight = 30, wheelStep = 30, o = ops || {}, cwidth = o.width || \"auto\", cheight = o.height ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/","og_site_name":"JassWeb","article_published_time":"2023-02-09T07:41:56+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How can i scroll the page with img tag [closed]","datePublished":"2023-02-09T07:41:56+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/"},"wordCount":24,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["css","html","javascript"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/","name":"[Solved] How can i scroll the page with img tag [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2023-02-09T07:41:56+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-scroll-the-page-with-img-tag-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How can i scroll the page with img tag [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/33532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=33532"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/33532\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=33532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=33532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=33532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}