I have different controls on screen and hide and show them asynchronously. Is there any way to track when an element becomes actually visible on the screen? I actually want to get a callback when that happens and move the focus on that element!
Javascript track when element became visible?
242 views Asked by fizampou At
2
There are 2 answers
0
guru1206
On
The only way that I can think of is to have a setInterval method which checks of the element.style.display!=="none", or whatever other method you used to hide and show the element.
Something like:
var myInterval = setInterval(function()
{
var element = document.getElementByID("SomeElement");
if( element.style.display!=="none" || element.style.visibility!=="hidden")
{
//exit the interval
clearInterval(myInterval);
doSomeFunction();
}
}, 20);
Related Questions in JAVASCRIPT
- Using Puppeteer to scrape a public API only when the data changes
- inline SVG text (js)
- An array of images and a for loop display the buttons. How to assign each button to open its own block by name?
- Storing the preferred font-size in localStorage
- Simple movie API request not showing up in the console log
- Authenticate Flask rest API
- Deploying sveltekit app with gunjs on vercel throws cannot find module './lib/text-encoding'
- How to request administrator rights?
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- In Datatables, start value resets to 0, when column sorting
- How do I link two models in mongoose?
- parameter values only being sent to certain columns in google sheet?
- Run main several times of wasm in browser
- Variable inside a Variable, not updating
Related Questions in HTML
- How to store a date/time in sqlite (or something similar to a date)
- How to use custom font during html to pdf conversion?
- Storing the preferred font-size in localStorage
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- Is there any way to glow this bulb image like a real light bulb
- With non-graphical maps in Leaflet, zoomDelta doesn't work
- What can I do to improve my coding on both html and css
- Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- Displaying a Movie List on a Website Using Jinja2 and Bootstrap
- How to redirect to thank you page after submitting a Google form embedded into a Google Site?
- Storing selected language in localStorage
- Fences (parenthesis, braces) in HTML and MathML
- Understanding Scroll Anchoring Behavoir
Related Questions in WINDOWS-8
- Rstudio for Windows 8.1 (64bit)?
- visual studio How do I run a windows 2008 ce Solution on VS 2017?
- How to solve a connection refused to localhost error SQLCODE -902?
- Access denied when using findstr windows command
- Signing kernel mode driver for Windows 8.1
- How to create share and grant multiple permissions on Windows8 using script
- Compiling Windows apps for other versions of Windows
- Windows 8 server , IIS 7.5 , .net version 4.6 , ASP.NET_SessionId cookies is not reflecting SameSite attribute
- HOW TO INSTALL A NODE V>14 IN WINDOWS 8?? Please someone help me
- git clone : This application requires one of the following versions of .NET Framework: .NET framework,Version =v4.7.2
- Error running WPF application using ChromiumWebBrowser from CefSharp.Wpf on Windows 8.0 SP1
- How to write programs for Windows RT?
- Flutter update causing error "Flutter requires PowerShell 5.0 or newer" irrecoverable
- Task Scheduler did not launch task "\abc" because instance "(GUID)" of the same task is already running
- VS Code Failed to Install Visual Studio Code Update
Related Questions in MODERN-UI
- C# WPF Modern UI disable or hide LinkGroup
- CodedUI for Modernui application
- Password protected page
- Make WPF ModernUI tab multiline
- Custom Size in Windows 8.1 Simulator
- Sharepoint - Weird language behavior after translation
- How to remove hover style for ListView rows?
- How to prevent automatic scaling in Modern UI IE 11 on Windows 8.1/8?
- Metro UI for WPF differences
- WPF - using modernUI - how can I set up a RoutedEvent generated from a user control?
- How to determine if IE is metro mode in PHP
- Javascript track when element became visible?
- Highlight links in a Quick Links web part on SharePoint modern page
- Sharing the ViewModel amongst multiple Views
- Windows Modern App vs Desktop app for Point of Sales
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
try this