Search Results

Search found 23 results on 1 pages for 'onscroll'.

Page 1/1 | 1 

  • Javascript onscroll and mouse position

    - by EddyR
    I have a script that runs a addEventListener for onmousemove and onscroll on the document body to get the cursor position. A onmousemove event works fine (client + scroll), however when a onscroll event occurs clientX/Y seems to inherit scrollTop/Left values instead (only scroll). Is there a way around this? clickDocument = (document.documentElement != undefined && document.documentElement.clientHeight != 0) ? document.documentElement : document.body; var posx = 0; var posy = 0; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX; posy = e.clientY; } var scrollx = window.pageXOffset == undefined ? clickDocument.scrollLeft : window.pageXOffset; var scrolly = window.pageYOffset == undefined ? clickDocument.scrollTop : window.pageYOffset;

    Read the article

  • onscroll for div

    - by The Machine
    Does a div element not have , an onscroll event handler ? The behaviour on my page, doesn't seem to indicate the div onscroll eventHandler is recognized. <div id='bd' onscroll='alert('Scroll Called');'></div>. Also, Do div scroll events roll up to window scroll events, as per DOM event bubbling ?

    Read the article

  • javascript scroll event for iPhone/iPad ?

    - by _ck_
    I can't seem to capture the scroll event on an iPad. None of these work, what I am doing wrong? window.onscroll=myFunction; document.onscroll=myFunction; window.attachEvent("scroll",myFunction,false); document.attachEvent("scroll",myFunction,false); They all work even on Safari 3 on Windows. Ironically, EVERY browser on the PC supports window.onload= if you don't mind clobbering existing events. But no go on iPad.

    Read the article

  • Handle window scroll event in greasemonkey script

    - by Akim Khalilov
    Hi. I need some advice. I have a web page and want to extend it's functionality with greasemonkey script and firefox. When page has loaded I need run custom function during user's page scrolling (with mouse whell or scrollbar). I want show some div block when user scrolling down and hide it when he scrolling to the top. But I met some problem - I couldn't assign event handler to the onscroll event. I use next part of the code: function showFixedBlock(){ ... } function onScrollStart(){ ... showFixedBlock(); ... } window.onscroll = onScrollStart; I test this piece of code on my test html page and it works, but when I copy it into greasemonkey, script doesn't work. Should I assign onscroll event handler during page loading? As I know greasemonkey execute it's scripts when page has loaded? Is it the reason of the problem? Is there some additional requirments to handle 'onscroll' event? How can I do that? Thanks.

    Read the article

  • internet explorer 7 iframe unloads when going back

    - by André
    Hi this is my first post here, so please be kind ;-) i'm implementing a browser history manager, just like rsh or yui browser history manager. The idea was not to constantly poll the url hash of a hidden iframe, but to capture the onscroll event of an iframe, when it scrolls to an anchor name on an urlhashchange. So on every click i add an new anchor to iframe and set the iframe's hash to the anchors name. When pressing the back or forward button the frame scrolls to the previous or next anchor and the onscroll event is fired. That works great on firefox 3.0+, IE6 and Opera but on IE7 when hiting the back button the frame unloads and loses all its anchors. If anyone has an idea why this is happening or even a fix for this "bug", please i'm slowly going insane over this. thanks in advance btw the onscroll idea comes from: http://www.zachleat.com/web/2008/08/21/onhashchange-without-setinterval/

    Read the article

  • Android: how to tell if a view is scrolling

    - by Dave
    in iPhone, this would be simple---each view has a scrollViewDidScroll method. I am trying to find the equivalent in Android. My code works, but it isn't giving me what I want. I need to execute code the entire duration that a view is scrolling. So, even though I use OnGestureListener's onScroll method, it only fires when the finger is on the screen (it's not really named correctly---it should be called "onSlide" or "onSwipe", focusing on the gesture rather than the UI animation). It does not continue to fire if the user flicks the view and it is still scrolling for a few moments after the user lifts his finger. is there a method that is called at every step of the scroll? public class Scroll extends Activity implements OnGestureListener { public WebView webview; public GestureDetector gestureScanner; public int currentYPosition; public int lastYPosition; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); webview = new WebView(this); setContentView(webview); webview.loadUrl("file:///android_asset/Scroll.html"); gestureScanner = new GestureDetector(this); currentYPosition = 0; lastYPosition = 0; } public boolean onTouchEvent(final MotionEvent me) { return gestureScanner.onTouchEvent(me); } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { // I do stuff here. return true; }

    Read the article

  • Using scroll on one memo edit to scroll on another as well

    - by Nathan Koop
    I've got two memoedits which are similar (in order to compare two records) I would like to keep the scrolling in synch to ease comparison. I had originally thought there would be an OnScroll event, but didn't see one, nor anything similar, the closest I saw was Spin, this handles some possibilities, but not all. I also didn't see a way to navigate the rows. I did see the ScrollToCaret method, but this doesn't do what I want. Any ideas?

    Read the article

  • Speeding Up Slow, CPU-Intensive Scrolling in WinForms

    - by S B
    How can I speed up the scrolling of UserControls in a WinForms app.? My main form has trouble scrolling quickly on slow machines--painting for each of the small scroll increments is CPU intensive. My form has roughly fifty UserControls (with multiple fields) positioned one below the other. I’ve tried intercepting OnScroll and UserPaint in order to eliminate some of the unnecessary re-paints for very small scroll events, but the underlying Paint gets called anyway. How can I streamline scrolling on slower machines?

    Read the article

  • which function to use for jquery while scrolling sidebars

    - by Mirage
    I have one image. i want that when someone scrolls the browser window then by jquery i should also change the image position from top as well I want to use jquery only . Is there function like that. I don't want to use position:fixed or something like that. I want something like onScroll(){ var x = getScrollDIstance(); moveImageDown(x); }

    Read the article

  • Android ListView in Activity

    - by Dev.Android
    My layout is like this Title Layout Listview BottomLayout. I have an 150 item which i have custom layout which i want to add in listview. So my main problem is i want to add slowly slowly one by one that customlayouts in listview. So whenever the first screen is displayed i want load 10 items from server and add it to listview.then onscroll down i want to load the remaining 10 items from 150 cutom layouts. So how can I do this activity?

    Read the article

  • Unexpected token }

    - by tann98
    i have a script, to open a model window, but it wont work. google chrome give me "Uncaught SyntaxError: Unexpected token }", but on a line that doesnt even have a closing curly brace. here is my script: function showm(id1){ window.onscroll=function(){document.getElementById(id1).style.top=document.body.scrollTop;}; document.getElementById(id1).style.display="block"; document.getElementById(id1).style.top=document.body.scrollTop; } does anybody have any ideas on this? any help is appreciated.

    Read the article

  • where to place browser event (resize/scroll) detection call

    - by karl
    I'm trying to alert a message when the browser is resized or scrolled. I'm detecting the 2 events in the body <body onResize="doDisp();" onScroll="doDisp();" > where doDisp is this inside the <script> tag <script type="text/javascript"> function doDisp(){ alert("browser changing state"); } </script> but isn't it bad practice to have javascript in the body tag? Is there a cross-browser way to keep all the javascript inside the <script> tags?

    Read the article

  • Change Modul popup every 30 sec Javascript

    - by SoftwareDeveloper
    I have a div id called modalpage and have css. I need a javascript function which can dynamically shows popup for 20 mins and change in every 30 secs right now i have the following javascript function. Can anybody help me please <script language="javascript" type="text/javascript"> function revealModal(divID) { window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; }; document.getElementById(divID).style.display = "block"; document.getElementById(divID).style.top = document.body.scrollTop; } which is called by a input id button. <input id="Button1" type="button" value="Click here" onclick="revealModal('modalPage')" /> Thanks

    Read the article

  • Opening html modal dialog

    - by Hulk
    All, I need to get the contents below on a modal window.I had been trying this for a while today. On modal window opened the background body contents are not accessible.and on reload page the modal popup should close down leavinfg the contents of the text area as it is. <a href="" id="link">Open Popup</a> <table><tr width="10%"><td> <TEXTAREA name="text1" id="text1" rows="15" cols="65" onscroll="sync();" spellcheck="false"></TEXTAREA> </td> <td> <TEXTAREA Name="text2" id="text2" rows="15" cols="65" spellcheck="false"> </TEXTAREA> </td></tr> <tr> <tr width="90%"><td> </td> </tr> </table> <input type="button" value="Compile" onclick="stat('')"/> <input type="button" value="Reload Page" onClick="window.location.href=window.location.href"> Thanks..

    Read the article

  • Is there a problem with scrollTop in Chrome?

    - by Shaun
    I am setting scrollTop and scrollLeft for a div that I am working with. The code looks like this: div.scrollLeft = content.cx*scalar - parseInt(div.style.width)/2; div.scrollTop = content.cy*scalar - parseInt(div.style.height)/2; This works just fine in FF, but only scrollLeft works in chrome. As you can see, the two use almost identical equations and as it works in FF I am just wondering if this is a problem with Chrome? Update: If I switch the order of the assignments then scrollTop will work and scrollLeft won't. <div id="container" style = "height:600px; width:600px; overflow:auto;" onscroll = "updateCenter()"> <script> var div = document.getElementById('container'); function updateCenter() { svfdim.cx = (div.scrollLeft + parseFloat(div.style.width)/2)/scalar; svfdim.cy = (div.scrollTop + parseFloat(div.style.height)/2)/scalar; } function updateScroll(svfdim, scalar, div) { div.scrollTop = svgdim.cy*scalar - parseFloat(div.style.height)/2; div.scrollLeft = svgdim.cx*scalar - parseFloat(div.style.width)/2; } function resizeSVG(Root) { Root.setAttribute("height", svfdim.height*scalar); Root.setAttribute("width", svfdim.width*scalar); updateScroll(svgdim, scalar, div); } </script>

    Read the article

  • javascript text overlay

    - by Gwilym
    Im pretty unknowledgeable about javascript being desktop application rather a web programmer but I'm trying to add an element to a friends website. Google has failed all my attempts to find a script I can adapt. What I want is a small text box in the bottom right hand corner of the browser window that sits above the html/css, that will disappear if the user scrolls. could provide a small chunk of javascript that could help? or point me to a script which could be adapted. thanks [EDIT] Final Code HTML: <body onscroll="document.getElementById('textbox').style.display = 'none';" > <div id="textbox"> Please Scroll down for more information </div> CSS #textbox { background-color :#FF732F; border: solid 1px #5F6800; padding: 5px; position: absolute; z-index: 9999; right: 0; bottom:0; } [/EDIT]

    Read the article

  • Stuck in implementing Pagination in Android

    - by user443141
    I am implementing pagination for ListView in Android . I am extending the BaseAdapater class for customising the ListView. Already I have the code working fine for the Customised ListView. Below is the new requirement. 1I am fetching 6 items from server & displaying them . Now when the user scrolls to the 6th item(end of list) , I need to call the server to fetch the next 6 items & update the Listview I have overriden the methods ipublic void onScroll(AbsListView view, int firstVisibleItem,int visibleItemCount, int totalItemCount) iipublic void onScrollStateChanged(AbsListView view, int scrollState) In the first response from the server, I get the total no of pages from the server & for each time I call the server , I get the current page value . Kindly provide me the steps/sample code on how to check the last item of the list & update the list . The code should be iterative since I may need to call multiple times & fetch from server. Warm Regards, CB

    Read the article

  • Android onFling not responding

    - by Kevin Moore
    I am new to android first of all so think of any newbie mistakes first I am trying to add a fling function in my code. public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback, OnGestureListener { private MainThread thread; private Droid droid; private Droid droid2; private static final String TAG = gameView.class.getSimpleName(); private GestureDetector gestureScanner; public MainGamePanel(Context context){ super(context); getHolder().addCallback(this); droid = new Droid(BitmapFactory.decodeResource(getResources(), R.drawable.playerbox2), 270, 300); droid2 = new Droid(BitmapFactory.decodeResource(getResources(), R.drawable.playerbox2), 50, 300); thread = new MainThread(getHolder(), this); setFocusable(true); gestureScanner = new GestureDetector(this); } public boolean onTouchEvent(MotionEvent event){ return gestureScanner.onTouchEvent(event); } @Override protected void onDraw(Canvas canvas){ canvas.drawColor(Color.BLACK); droid.draw(canvas); droid2.draw(canvas); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { droid.setX(50); droid.setY(50); Log.d(TAG, "Coords: x=" + e1.getX() + ",y=" + e2.getY()); return true; } @Override public boolean onDown(MotionEvent e) { droid2.setX((int)e.getX()); droid2.setY((int)e.getY()); Log.d(TAG, "Coords: x=" + e.getX() + ",y=" + e.getY()); return false; } I got the gestureListener to work with: onDown, onLongPress, and onShowPress. But i can't get any response with onFling, onSingleTapUp, and onScroll. What mistake am I making? does it have to do with views? I don't know what code would be useful to see.... so any suggestions would be much appreciated. Thank You!

    Read the article

  • TVirtualStringTree - resetting non-visual nodes and memory consumption

    - by Remy Lebeau - TeamB
    I have an app that loads records from a binary log file and displays them in a virtual TListView. There are potentially millions of records in a file, and the display can be filtered by the user, so I do not load all of the records in memory at one time, and the ListView item indexes are not a 1-to-1 relation with the file record offsets (List item 1 may be file record 100, for instance). I use the ListView's OnDataHint event to load records for just the items the ListView is actually interested in. As the user scrolls around, the range specified by OnDataHint changes, allowing me to free records that are not in the new range, and allocate new records as needed. This works fine, speed is tolerable, and the memory footprint is very low. I am currently evaluating TVirtualStringTree as a replacement for the TListView, mainly because I want to add the ability to expand/collapse records that span multiple lines (I can fudge it with the TListView by incrementing/decrementing the item count dynamically, but this is not as straight forward as using a real tree). For the most part, I have been able to port the TListView logic and have everything work as I need. I notice that TVirtualStringTree's virtual paradigm is vastly different, though. It does not have the same kind of OnDataHint functionality that TListView does (I can use the OnScroll event to fake it, which allows my memory buffer logic to continue working), and I can use the OnInitializeNode event to associate nodes with records that are allocated. However, once a tree node is initialized, it sees that it remains initialized for the lifetime of the tree. That is not good for me. As the user scrolls around and I remove records from memory, I need to reset those non-visual nodes without removing them from the tree completely, or losing their expand/collapse states. When the user scrolls them back into view, I can re-allocate the records and re-initialize the nodes. Basically, I want to make TVirtualStringTree act as much like TListView as possible, as far as its virtualization is concerned. I have seen that TVirtualStringTree has a ResetNode() method, but I encounter various errors whenever I try to use it. I must be using it wrong. I also thought of just storing a data pointer inside each node to my record buffers, and I allocate and free memory, update those pointers accordingly. The end effect does not work so well, either. Worse, my largest test log file has ~5 million records in it. If I initialize the TVirtualStringTree with that many nodes at one time (when the log display is unfiltered), the tree's internal overhead for its nodes takes up a whopping 260MB of memory (without any records being allocated yet). Whereas with the TListView, loading the same log file and all the memory logic behind it, I can get away with using just a few MBs. Any ideas?

    Read the article

  • TVirtualStringTree - resetting non-visual nodes and memory comsumption

    - by Remy Lebeau - TeamB
    I have an app that loads records from a binary log file and displays them in a virtual TListView. There are potentially millions of records in a file, and the display can be filtered by the user, so I do not load all of the records in memory at one time, and the ListView item indexes are not a 1-to-1 relation with the file record offsets (List item 1 may be file record 100, for instance). I use the ListView's OnDataHint event to load records for just the items the ListView is actually interested in. As the user scrolls around, the range specified by OnDataHint changes, allowing me to free records that are not in the new range, and allocate new records as needed. This works fine, speed is tolerable, and the memory footprint is very low. I am currently evaluating TVirtualStringTree as a replacement for the TListView, mainly because I want to add the ability to expand/collapse records that span multiple lines (I can fudge it with the TListView by incrementing/decrementing the item count dynamically, but this is not as straight forward as using a real tree). For the most part, I have been able to port the TListView logic and have everything work as I need. I notice that TVirtualStringTree's virtual paridigm is vastly different, though. It does not have the same kind of OnDataHint functionality that TListView does (I can use the OnScroll event to fake it, which allows my memory buffer logic to continue working), and I can use the OnInitializeNode event to associate nodes with records that are allocated. However, once a tree node is initialized, it sees that it remains initialized for the lifetime of the tree. That is not good for me. As the user scrolls around and I remove records from memory, I need to reset those non-visual nodes without removing them from the tree completely, or losing their expand/collapse states. When the user scrolls them back into view, I can re-allocate the records and re-initialize the nodes. Basically, I want to make TVirtualStringTree act as much like TListView as possible, as far as its virtualization is concerned. I have seen that TVirtualStringTree has a ResetNode() method, but I encounter various errors whenever I try to use it. I must be using it wrong. I also thought of just storing a data pointer inside each node to my record buffers, and I allocate and free memory, update those pointers accordingly. The end effect does not work so well, either. Worse, my largest test log file has ~5 million records in it. If I initialize the TVirtualStringTree with that many nodes at one time (when the log display is unfiltered), the tree's internal overhead for its nodes takes up a whopping 260MB of memory (without any records being allocated yet). Whereas with the TListView, loading the same log file and all the memory logic behind it, I can get away with using just a few MBs. Any ideas?

    Read the article

  • MSDN "pseudoframe"

    - by bobobobo
    So, I'm trying to replicate MSDN "pseudoframes" here. Their pages are laid out like they're using an old-school frameset, but inspecting their elements with firebug reveals they've done this with purely div's. Here's my attempt at it. Its not perfect though, it only works in Chrome and Firefox, it has this weird highlight select behavior that I don't like, any takers? <!doctype html> <html> <head> <title>msdn "pseudoframe"</title> <style> body { background-color: #aaa; margin: 0; padding: 0; } div#pseudoframe, div#main { border: solid 1px black; background-color: #fff; } div#pseudoframe { position: absolute; left: 0; width: 180px; height: 100%; overflow-x: auto; overflow-y: none; } div#sizeMod { background-color: #a0a; position: absolute; left: 220px; height: 100%; cursor: e-resize; } div#main { font-weight: bold; font-size: 2em; padding: 24px; margin-left: 224px; } </style> <script type="text/javascript"> function initialize() { // get the pseudoframe and attach an event to the mouse flyover. var pf = document.getElementById('pseudoframe'); var main = document.getElementById('main'); var resize = document.getElementById( 'sizeMod' ); pf['onmouseover'] = function( event ) { event = event || window.event; var el = event.srcElement || event.target ; // are we within 5 px of the border? if we are, // change the mouse cursor to resize. }; pf['onscroll'] = function( event ) { event = event || window.event; var el = event.srcElement || event.target ; var sizeMod = document.getElementById( 'sizeMod' ); //alert( el.scrollLeft ); sizeMod.style.right = '-' + (el.scrollLeft) + 'px'; //alert( sizeMod.style.right ); // are we within 5 px of the border? if we are, // change the mouse cursor to resize. }; resize['onmousedown'] = function( event ) { event = event || window.event; var el = event.srcElement || event.target ; window.lockResize = true; }; window['onmouseup'] = function( event ) { event = event || window.event; var el = event.srcElement || event.target ; window.lockResize = false; //release on any mouse up event //alert('unlocked'); }; window['onmousemove'] = function( event ) { event = event || window.event; var el = event.srcElement || event.target ; if( window.lockResize == true ) { // resize. get client x and y. var x = event.clientX; var y = event.clientY; pf.style.width = x + 'px'; resize.style.left = x + 'px'; main.style.marginLeft = x + 'px'; //alert( pf.style.width ); event.stopPropagation(); event.preventDefault(); return false; } }; } </script> </head> <body onload=" initialize(); "> <div id="pseudoframe"> <ul> <li>Code</li> <li>MICROSOFT CODE <ul> <li>WINDOWS XP SOURCE</li> <li>WINDOWS VISTA SOURCE</li> <li>WINDOWS 7 SOURCE</li> <li>WINDOWS 8 SOURCE</li> </ul> </li> <li>DOWNLOAD ALL MICROSOFT CODE EVER WRITTEN</li> <li>DOWNLOAD ALL MAC OS CODE EVER WRITTEN</li> <li>DOWNLOAD ALL AMIGA GAME CONSOLE CODE</li> <li>DOWNLOAD ALL CODE EVER WRITTEN PERIOD</li> </ul> </div> <div id="sizeMod">&nbsp;&nbsp;</div> <div id="main"> lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe lorem ipsum microsoft pseudoframe </div> </body> </html>

    Read the article

1