Javascript Articles

Page 450 of 534

Is their JavaScript scroll event for iPhone/iPad?

Abhinanda Shri
Abhinanda Shri
Updated on 23-Jun-2020 415 Views

Yes, iOS capture onscroll events for a scroll. This is called one-finger events. What the user is tapping or touching decides whether an event is generated or not.Here is panning gesture,Image credit − AppleIt can also be touch and hold gesture,Image credit − Apple

Read More

How to set the brightness and contrast of an image with JavaScript?

Sharon Christine
Sharon Christine
Updated on 23-Jun-2020 4K+ Views

To set the brightness, use the brightness property and for contrast, use the contrast property.ExampleYou can try to run the following code to use image filters with JavaScript −Live Demo           Click below to change the brightness and contrast of the image.       Edit Image                      function display() {             document.getElementById("myID").style.filter = "brightness(50%)";             document.getElementById("myID").style.filter = "contrast(50%)";          }          

Read More

How to set the page-break behavior after an element with JavaScript?

Nikitha N
Nikitha N
Updated on 23-Jun-2020 901 Views

Use the pageBreakAfter property in JavaScript to set the page-break behavior after an element. Use the always property for page after an element.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior after an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This if footer text.       Set page-break                function display() {             document.getElementById("myFooter").style.pageBreakAfter = "always";          }          

Read More

How to set the page-break behavior inside an element with JavaScript?

Anvi Jain
Anvi Jain
Updated on 23-Jun-2020 3K+ Views

Use the pageBreakInside property in JavaScript to set the page-break behavior inside an element. Use the auto property to insert page break inside an element. Use auto or avoid property value to automatically insert page break inside an element, if needed, or avoid a page break, respectively.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior inside an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This ...

Read More

How to set the minimum number of lines for an element that must be left at the bottom of a page when a page break occurs inside an element with JavaScript?

Srinivas Gorla
Srinivas Gorla
Updated on 23-Jun-2020 157 Views

Use the orphans property in JavaScript to set the minimum number of lines for an element that should be left at the bottom of a page when a page break occurs inside an element with JavaScript.You can return the orphans property like this −var res = object.style.orphansSet the orphans property like this −object.style.orphans = 'number|initial|inherit'The following are the property values shown above −number − Specify the minimum number of visible lines.Initial − Set property to its defaultInherit − Inherits property from the parent element

Read More

How to set the page-break behavior before an element with JavaScript?

Nancy Den
Nancy Den
Updated on 23-Jun-2020 598 Views

Use the pageBreakBefore property in JavaScript to set the page-break behavior before an element. Use the always property to insert a page break before an element.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior before an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This if footer text.       Set page-break                      function display() {             document.getElementById("myFooter").style.pageBreakBefore = "always";          }          

Read More

How to set the left position of a positioned element with JavaScript?

Rishi Raj
Rishi Raj
Updated on 23-Jun-2020 1K+ Views

Use the left property to set the left position of a positioned element, such as a button.ExampleYou can try to run the following code to set the left position of a positioned element with JavaScript −Live Demo                    #myID {             position: absolute;          }                     Heading 1       This is Demo Text.       Change Left Position                function display() {             document.getElementById("myID").style.left = "150px";          }          

Read More

How to create or reset counters with JavaScript?

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 933 Views

To create counters, use the counterReset property in JavaScript. You can try to run the following code to create or reset one or more counters with JavaScript −ExampleLive Demo                    h2:before {             counter-increment: section;             content: counter(section) " Quiz ";          }                     Quizzes       Change the counterIncrement       Ruby       Java       PHP       Perl       Reset Counter                function display() {             document.body.style.counterReset = "section";          }          

Read More

Which is the best JavaScript compressor?

Nitya Raut
Nitya Raut
Updated on 23-Jun-2020 256 Views

Here are some of the best JavaScript compressors available −Google Closure CompilerThe Google Closure compiler runs JavaScript quickly and used for a superior JavaScript. It parses your JavaScript, analyzes it, removes dead code, rewrites, and minimizes what's left.JSMinIf you want to minify, then use the JSMin to remove unnecessary comments.YUI CompressorThe YUI Compressor is used to minify the JavaScript files fastly and is secure.

Read More

How to make flexible items display in columns with JavaScript?

Smita Kapse
Smita Kapse
Updated on 23-Jun-2020 246 Views

Use the flexFlow property to set the flexible items to be visible in columns.ExampleYou can try to run the following code to make flexible items display in columns with JavaScript −                    #box {             border: 1px solid #000000;             width: 100px;             height: 150px;             display: flex;             flex-flow: row wrap;          }          #box div {             height: 40px;             width: 40px;          }                                  DIV1          DIV2          DIV3             Using flexDirection property       Set                function display() {             document.getElementById("box").style.flexFlow = "column nowrap";          }          

Read More
Showing 4491–4500 of 5,338 articles
« Prev 1 448 449 450 451 452 534 Next »
Advertisements