Way To Refresh A Function Upon Mouse Scroll
Jan 25, 2010
I have a home grown lightbox effect as my client cannot have community code such as JQuery, mootools etc running on their site (don't ask me....). All is working fine, the background darken mask with the box itself with the content. The only problem I'm having is what happens when the user scrolls.
As the mask is calculated upon clicking a link to display the lightbox, the method calculates the current screen area and uses that to create the height and width of the mask. But obviously if you scroll, you leave the mask behindat the top of the screen covering the calculated area. Is there a way to access the onscroll event to say rerun the specific function that calculates the mask area when the user scrolls so the mask stays constantly covering the available screen area? I suppose this is similar to those scripts where a div remains in view when the user scrolls - presumably something along those lines?
I found and tried a script to do with captured delta movement of the mousewheel but that disconnect the mouse wheel from the scrolling of the scroll bar and associated it only with the script in hand - I would like the browser to still scroll and my function to be fired on each scroll event.
View 1 Replies
ADVERTISEMENT
Jan 3, 2007
Is there a way in which we can disable the history scroll functionality in IE? Basically disable the SHIFT key + Mouse Scroll combination.
View 1 Replies
View Related
May 24, 2004
I have wrote this for a friend in another forum, But I thought it might be useful, at least for start for similar apllication.
Tho code scrolles the page if mouse moves in the 1/3 zones (left, right, up, down) of the page (clientWidth/Height). It might be modify (a better ideea, since I don't like scrolled full pages - at least the X-scrolled) for scrollable frames, iframes or layers). I would be grateful if any comments will simplify he code or will help me to build a similar application based on simple position of the mouse (not only on mousemove).
<html>
<head>
<script>
function setUp() {
if( typeof( window.innerWidth ) == 'number' ) {
/* Non-IE */
winW = window.innerWidth;
winH = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
/* IE 6+ in 'standards compliant mode' */
winW = document.documentElement.clientWidth;
winH = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
/*IE 4 compatible*/
winW = document.body.clientWidth;
winH = document.body.clientHeight;
}
setL = winW/3;// zone left first 1/3 from client width
setR = winW*2/3;// zone right third 1/3 from client width
setU = winH/3;// zone up first 1/3 from client height
setD = winH*2/3;// zone down third 1/3 from client width
pix=4// scroll speed control pixels/mousemove
}
function checkS(e){
// capture the mouse position
var posx = 0;
var posy = 0;
if (!e) var e = window.event;
if (e.pageX || e.pageY)
{
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY)
{
posx = e.clientX;
posy = e.clientY;
}
// initialize the scrollBy parameters
x=0;
y=0;
// set the new scrollBy parameters
if(posx<setL){
x=-pix;
}
if(posx>setR){
x=pix;
}
if(posy<setU){
y=-pix;
}
if(posy>setD){
y=pix;
}
// scroll
window.scrollBy(x,y);
}
</script>
</head>
<body onload="setUp()" onmousemove="checkS(event)">
<table width="1200" height="900" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle" bgcolor="#CCCCCC">blabla</td>
</tr>
</table>
</body>
</html>
View 3 Replies
View Related
Oct 27, 2009
I have been searching google for a solution to this, but I am having trouble finding something that works.
I simply want to be able to scroll the contents of a div (with no scrollbar) using the mouse wheel. The div should only scroll if the cursor is over the div when the wheel is moved.
Does anyone know where to find a good working solution to this?
View 3 Replies
View Related
Oct 4, 2010
I've a DIV which contains an IMG. This image is wider than the div, so a scrollbar appears on page. What I want to do, is click on the div(image) and move the mouse, and scroll the div as I move the mouse.I've tried using event ondrag in the div, and inside I can move the scroll with scrollTop and/or scrollLeft. My problem is that I haven't been able to make a good algorithm. I've tried to add clientY to scrollTop, and many other combinations but can't make it work. I have a lot of other javascript functionality in the page that is working.
View 6 Replies
View Related
Aug 16, 2011
i have a container div with many other nested divs inside e.g.
<div id="thisOne">
div>Div 1</div>
<div>Div 2</div>
[code]....
View 1 Replies
View Related
Sep 15, 2011
Adapting this code may not be the best method, see what you think.
I have a page where certain actions cause the page to reload and then jumps to an anchor (e.g. #title gets appended to the url) which is disorientating, I think it will soften the blow if the page scrolls to the anchor.
This is code I use to scroll to anchors with links on a page code...
I see that this is a click function. Can this just be amended so that it checks the url and scrolls accordingly?
View 3 Replies
View Related
Jul 28, 2011
I know how to hide the scroll bar but not how to enable scrolling.
I did google a bit and found some solution that did not work for me. (currently using crome on mac) code...
Does anyone know a good way of doing that?
View 1 Replies
View Related
Nov 7, 2011
I was wondering how and I tried creating a div that is a child of a div with its same width, but the length of the entire page.So in a way it is like a scroll-bar except the user can not move down the page by holding the smaller inner div (square). The small square just moves down its container as the mouse moves down to The bottom of the page.but since The square inner div is in a container, with the same with, it can not and will not be able to move horizontally.
View 7 Replies
View Related
Jul 5, 2009
I would like to have the scroll box content to go to the same position that it had before the page is refreshed rather than go to the top of the scroll box content. In other words, if the user scrolls down, then refreshes the page, I want to scroll box content to come back to the same position after the refresh.
I assume this would be a javascript function to get a vertical scroll position. Hopefully one solution works for all major browsers.
View 2 Replies
View Related
Apr 6, 2010
I've added a scroll script to my site which changes the scroll to just a black box in a grey rectangle. When the page is visited it doesn't show but once you either refresh or navigate through the pages it appears. I'm pretty much clueless about js so don't even know where to start with fixing this. Here's a link [URL]. I would post code but once again, not sure which part I'm dealing with so not sure what to post. If you need code let me know and I will provide it.
View 11 Replies
View Related
Jul 23, 2005
i have a page that refreshes every minute. i would like to cancel the
refresh when the mouse is over my image and refresh the page when the mouse
moves out of the image.
View 3 Replies
View Related
Oct 2, 2009
I have small webBrowser1 and I have the 3 Buttons(Back, Forward,Go) also I have the ComboBox1 with the Items Collection of different website url using MSVB 2008 in C++.My question:
1) How could I make my mouse click on each url with timer between the first url and the second and so on and let's say time between the 1st url and scroll down to the second with timer of 3 second .
2) How to make also the mouse click on certain button on that website what is the command code for that.
View 1 Replies
View Related
Dec 19, 2010
I have an iframe that contains x.asp:Code:<iframe name=chat width=90% height=50% frameborder=0 src=x.asp></iframe>x.asp is refreshed every 1 second using metatag. The problem is that everytime x refreshes, x goes top so the last line is not visible.What I need is a javascript that when x refreshes, scroller automatically goes to the last line
View 1 Replies
View Related
Aug 18, 2009
I'm creating a script which causes the page to scroll when the mouse is held down within 1/3 of the page height of the window edge. An example can be found at [URL], and is working fine in Firefox, Safari and Chrome, but not in IE. I'm 90% certain this is due to the browser's non-handling of addEventListener, but I'm not sure how to fix this...I've tried the following so far:
[Code]...
View 1 Replies
View Related
Jun 28, 2011
How is it possible to slide right/left within a horizontal scroll window for as long as the mouse-down action is triggered (preferably with jQuery)? Couldn't find any examples // functions to do that..
View 1 Replies
View Related
Apr 4, 2010
I'm wanting a table cell click event to remove and replace the table it was clicked on, however I'm finding that as it's deleting the original table object the actual running event code is being replaced and the function is bailing.how I can call the delete/refresh function from outside the event's function scope?
View 1 Replies
View Related
Mar 26, 2009
First the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript">
function TextScroll(scrollname, div_name, up_name, down_name, top_name){
[Code]...
When I use mouse wheel in Firefox to scroll contents of the DIV, memory usage in Firefox goes through the roof. Code above is a fully working page, if anyone would like to see what's up, just load it up, and start moving your mouse wheel in the area with text. You don't actually have to scroll the text, just moving the wheel back and forth in that DIV will do. Memory usage will start going up quite fast, and after you stop moving the wheel, it will finally come down a bit after a short while. I've highlighted in red the line where mousewheel event is registered for Firefox. I'm not sure if it's really a problem, but since Opera and IE don't have any strange memory usage, and Firefox does, maybe I did something wrong. In everyday use it shouldn't matter [don't expect to have kilometers of content to scroll], but anyway, it is a bit unsettling.
View 2 Replies
View Related
Oct 25, 2010
Here is the page I'm working on: [URL].. As you will see there are only two pictures on there now. I want the left table cell to have an up arrow and a down arrow below those pictures where the user can scroll (down and up) and see other pictures, which when clicked on will show a larger image to the right. It's setup now as you will see for the larger image to appear to the right. It's just not setup for this scroll function where the user can click on an up arrow or down arrow to make the users see the other pictures in the table cell. Also this section should not have a scrollbar show up when the pictures are being scrolled down to see. I'm not sure on how to proceed with this.
View 3 Replies
View Related
Feb 13, 2011
I need to have a function run only once when the user scrolls. My problem is that I can't seem to figure out how to get .scroll to only check for that first scroll. I have come up with a working solution using a count, but I am hoping there is a better way to do it. I assume that it checking for a scroll constantly is just a waste of resources. My solution doesn't fix that problem, it only makes sure the function runs once.
Here is what I have:
View 2 Replies
View Related
Oct 9, 2010
A function that I got from a book.
I know that this code shows whether the user has clicked the link with the right or left button but I dont exactly know what each line of code does.
View 2 Replies
View Related
Oct 21, 2002
I want to have two options on a form, one to refresh the form, and another to submit the form.
the way i have it set up now is through a regular html form with asp doing the calculations needed in it. if i change the value in a textbox, i want to be able to press refresh and have asp recalculate it. i'm able to do that, but now i don't have a way to actually submit the form because i already have a form method that sends it back to asp for recalculation.
can you think of a way to submit a form to two different locations based on two different buttons?
View 5 Replies
View Related
Aug 17, 2011
I need to toggle 2 function on mouse click, I am posting my work below
In my domain [URL] when you click @ current work. you find a T-shirt with a Page flip
When I click the Page Flip I need to detail about the product and again on flip the image should return back but now when I click the flip the img is hiding and its displaying the description but I lost the flip icon
I need to return back the img on clicking again the page flip.
View 1 Replies
View Related
Nov 12, 2009
now i am making a navigation menu using images by on mouse over function,i want to make a div that shows menu using css and javascript function
View 2 Replies
View Related
Nov 22, 2011
I wish to implement the simplest mechanism of authentication. There are two input fields, userand password. When clicking the sendbutton, the verify()function is invoked, which checks whetherthe usernameand passwordare both "admin", if it holdsthen it displays the isCorrectdiv, and the isWrongotherwise.
test.html
<html><head>
<link rel="stylesheet" type="text/css" href="test.css"/>
<script src="jquery-1.7.js"></script>
<script src="test.js"></script>
</head><body><form class="header">
Username: <input type="textbox" tabindex="1" id="username"/>
Password: <input type="password" tabindex="2" id="password"/>
<input type="submit" value="Send" tabindex="3" id="send" onclick="verify()"/>
</form><div id="isCorrect">correct!</div>
<div id="isWrong">wrong!</div>
</body></html>
test.css
#isCorrect { display: none; }
#isWrong { display: none; }
test.js
function verify() {
var username = $("#username").val();
var password = $("#password").val();
if (username == "admin" && password == "admin")
$("#isCorrect").toggle();
else
$("#isWrong").toggle();
}
View 1 Replies
View Related
Jan 18, 2010
Is there a way to call a javascript function in a meta refresh statement? I'm refreshing my page but if I have data in my fields I don't want to loose them. If I can call using a JS function then in that function I can call the Submit function and save my data in the called script.
My syntax below doesn't fire the JS function:
<meta http-equiv="refresh" content="30;url=javascript:auto_refresh();">
View 1 Replies
View Related