skip to Main Content

A jquery function to decrease font size each time a button is pressed

Please help. function fontDown() { var curSize = parseInt($('.box').css('font-size')); curSize--; $('.box').css('font-size', curSize + "pt").css('line-height', curSize + "pt"); } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button onclick="fontDown()">button</button> <div class="box" style="font-size: 14pt; line-height: 14pt;">sometext</div> I expect the font-size to decrease each time I press the button.…

VIEW QUESTION

Do something in jQuery repeatedly on all children of a parent

I've got following code: (function($) { $(".tmb:first-child").on('mouseenter', function() { $(".style-light-bg").css("background-color", "rgb(208,206,202)"); $(".tmb:nth-child(2)").addClass("filtered"); }); $(".tmb:first-child").on('mouseleave', function() { $(".style-light-bg").css("background-color", "#e6e5e2"); $(".tmb:nth-child(2)").removeClass("filtered"); }); $(".tmb:nth-child(2)").on('mouseenter', function() { $(".style-light-bg").css("background-color", "rgb(177,180,174)"); $(".tmb:first-child").addClass("filtered"); }); $(".tmb:nth-child(2)").on('mouseleave', function() { $(".style-light-bg").css("background-color", "#e6e5e2"); $(".tmb:first-child").removeClass("filtered"); }); })(jQuery); .style-light-bg { background-color: #e6e5e2; transition:…

VIEW QUESTION

Jquery Long press and prevent click

One button, detecting click and long press: $('#button').on('click', function(e) { e.preventDefault(); CLICK() }); $('#button').on('mousedown touchstart', function() { LongPressTimer = setTimeout(function() { LONGPRESS() }, 1000) }) .on('mouseup mouseleave touchend', function(e) { e.preventDefault(); e.stopPropagation(); clearTimeout(LongPressTimer) }); Click works, long press works. But…

VIEW QUESTION

Cursor Resize on scroll bar of div – Jquery

The Html div with cursor resize and scroll auto: .scrollable { cursor: ew-resize; border-color: red; height: 200px; max-height: 150px; overflow: scroll; } <div class="scrollable"> <h1>My First CSS Example</h1> <p>This is a paragraph.</p> <p>This is a paragraph.</p> </div> The div is…

VIEW QUESTION
Back To Top
Search