Prevent Window From Scrolling To The Top After Popup Message
May 9, 2010
So I have a webpage listing a bunch of book titles. I have coded a popup message with the book summary to appear when the title is clicked on. There is one problem. After the viewer reads a summary he or she clicks ok on the popup message, and then the window automatically scrolls back to the top. This will be a nuisance; if the user is half way or close to the end of the list, he or she would have to keep scrolling back down to his or her spot after reading the book summary.
I'm looking for nice solution to handle file downloads. The problem with classic link in <a href="file"> is that in case of missing file, the main browser window is reloaded with 404 error, but I'd like to present to user a popup message without reload of main browser window.
for opening a PopUp Window I use the Popup.js from Adrian "yEnS" Mato Gondelle. Adrian has written a function to center the popup by calculating the window height/with and popup width/height as well ans putting the coord in the middle of these coordinates. Like this:
function centerPopup(){ //request data for centering var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight;
[Code].....
My Problem with this is, that it only centers the Popup correctly if you haven't scrolled down the page. What I need is a jQuery way to get the height of the actually scolled position to calculate the correct value for the top css parameter as well, to get my PopUp every time in the correct top/left position without having this scrolling bug. Is there a way in jQuery how I can get the scrolled down coordinates? I need the height of the scrolled position and by adding the half height of the screen resolution I have the css top value which I need here.
I searched a while on the web for this but i didn't find a solution that really worked. So is there a way how i can prevent IE9 from scrolling when i use the arrow keys?
Is there any way I can prevent IE from displaying the "active X controls and script prevention message" when I load my web page into the browser. Firefox, Safari and Chrome, allow my scripts to run without displaying the message when the page is loaded into the respective browsers.
On this test page, if you click the contact link, then submit, the page jumps to the top.. i guess that page is refreshing?? How can I prevent this jump to the top and have the page stay still?
jQuery - Scrolling browser Window. I have two demos of scrolling page content with jQuery.
This one - [url] is scrolling the contents inside a container and it works as I wanted on Mac/PC
Code:
I need the same effect as above but I need to scroll the whole browser window.
I have a demo here - [url]
Code:
Problem here is on the Mac the transition are jumpy and it seems to flash the first yellow div before sliding up or down. Testing on a PC it will slide down but won't slide up. How can I get the whole browser window to slide up and down with a smooth transition.
but for some reason if the page is long the whole page scrolls up so the top of the calendar is at the top of the browser, which actually hides the box that the date will end up in.
can anyone see how I can alter the code so that the page does not scroll up, but have the calendar show just below the box that the date will go in and the page does not scroll?
here is the full code that I am using to test this out with. code...
I'm using a code snippet to have a cursor placed in a form field once a page loads, see the below posted code.The form field in question is located below the fold.The problem is that when the page loads it will scroll the page downwards to show the form field, I don't want that happen. I only want the cursor to appear...not the whole page to scroll downwards when the page loads.what I can do to prevent the page from scrolling downward when using this code?It's happening with similar codes as well that places a cursor inside the form field.I only want the page to scroll downward when the user decides to scroll downward, not because of the cursor placement.
Code HTML4Strict: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I've gotten .load to load content into a div but if the window is not at the top of the page it scrolls back to the top each time the new content is loaded but I wanted to avoid any sort of change on the page other than the content in the div. It seems pointless if the user has to scroll back down to the div where the content is each time? code...
Is there a way to keep the window in the same position? Also while I'm at it - is there a more efficient way to write this considering I have 9 pages or should I just write this code out for each instance?
i am creating a Greasemonkey script that adds an ajax chat to a website. Greasemonkey is an addon for firefox that lets you modify the html code of websites before they are showed to the user.
I am in the process of creating a wizz feature that will allow you to send a message to a member and where ever he is on the web his gona receive it. The way it works right now is there's a hidden iframe in every page load and when the player has a message it popups a small window
It's working great but the popup is always instantly blocked because firefox has a popup bloker integrated and because it can popup on random websites they don't allow it and there for never gets the message ...
Everything else i tryed was blocked by the fact that it opens in the iframe that is invisible.
I even tryed doing it the old fashon way with an alert() but same thing you don't see it because it's in the hidden frame.
And i tryed adding top.alert() but i get a javascript the "Access Denied" message. The "Access Denied" error in any browser usually means that a script in one window or frame is trying to access another window or frame whose document's domain is different from the document containing the script.
I know DHTML AJAX popup would be the only way to give the user the message with out being blocked ... but how can i make it popup out of the iframe into the main frame with out being blocked in anyway ..
I have used a Javascript function for temperature conversion(attached with an external js file). When the temp is converted we are supposed to get a message box if the temps fall under a certain amount. Example: <90 degrees celcius : a message is supposed pop up. I haven't been able to code the message box correctly for it to work.
I am using a basic, include_once in the php, to redirect the user to another page (msgToUser.php), and display the desired message: For example on my profile page I have several instances of the following, whereby the $msgToUser variable may be different depending on certain things:
Code:
$msgToUser = "You and $firstname are NOT friends, but a friend request was sent on $request_time <br />"; include_once('msgToUser.php'); exit();
[Code]....
What I want to be able to do, is replace all of these redirects with a simple jquery popup, particularly the Jquery Modal Dialog confirmation box (in case I want to include a link in the popup). I already have the jquery library on my site, along with the jquery-ui and jquery-css. Is there a simple way to do this by adding a little script to either the initial page or to the msgToUser.php page? Also would it be wise to keep the msgToUser.php page in place (somehow in conjunction with the jquery popup), in case someone does not have a js/jquery enabled browser?
I'm using an ActiveX control in my html page.. Each time i load the page ie pops a message box to allow the activex to run or not. Is there any way to handle that message box using javascript. Or is there any other way to avoid that message box because each time the page loads I have to give yes and then proceed. By default I've to give yes is there any way to handle that using javascript.
is it possible to scroll / jump to say, 10px above a div? i tried adding padding, but it doesn't work.also, when I use <a href="#xxxx">, is it possible to prevent the browser from adding #xxxx to the url in the browser?
I am trying to dynamically open a popup window but ie8 blocks it with the popup blocker. basically within a ajax fuction I have a confirm button and if the user clicks yes it opens a popup window. now I tried it with a javascript function but it got blocked, so I have tried it by creating a form with a button in it and instead of calling the popup function direct I call document.form.button.click and in the form my button has onclick"popup('<? echo url; ?>')" but this also is detected as a unwarranted popup and is blocked.
now I understand that the popup blocker works when a popup is called without user interaction, but allows popups on say button clicks. how can I get the popup to work
In my application i use window.showmodaldialog() to pop up a window. When i run it in IE pop up blocker wont blocks the window... But when run it in FireFox pop up blocker will blocks the pop up window.. is there any way to open a window with out blocking(avoiding ) by the pop up blocker?
I have very basic javascript skills, just started looking into jQuery and jQueryTools to enhance my websites. I have been coding PHP for about 1.5 years.I have a php form with which users can update their purchase order before making a final confirmation and payment.
Thought it would be nice if, instead of using php for redirecting to a success/fail message in a separate php file and redirecting again back to the form with a 3 second delay, I could get a jQuery script to pop up with a success/fail message, so avoiding all the clumsy php redirecting and page refreshing.I've searched for plugins, but they all act on event listeners attached to a submit button or other clickable html element.Ive searched the net for ages and can't find an easily understood explanation and complete example, where a jQuery pop up notification is displayed in response to a php script executing a db update.
Code: <script language=JavaScript> function scrollit(from, dist){ y = from; scrollEnd = y + dist; for (I=1; I<=scrollEnd; I++){ parent.scroll(1,I) } } </script> and i call it like this: <a href="#" onMouseOver="scrollit(0,500);">scroll</a>
but i was trying to make the window scroll from a position since my script will only scroll down from the top, how do i do this?
if i try iframe'ing this site [URL] it doesn't work :( , it automatically redirects the site to the parent window. this may be due to the some script code in that site :confused: ...
I want to prevent an opened window to be closed by clicking the right-top 'X' . Whenever user try to close the window by clicking the right-top 'X', an alert message will be generated and it will not be browser specific.
How can I create a popup message window, with a custom message, that asks a yes or no question? If they click yes, it can load another script or a page, if they click no it leaves them where they are? Can someone give me an example?