Alternative "scrollIntoView"
Dec 30, 2005
I found a problem while "scrolling into view" and to overcome this I made a function to simulate javascript's function. I would like to share it and here it is:
function alternativeScrollIntoView(parentDiv,elementIntoDiv )
{
var principal =parentDiv;
principal.scrollTop = 0;
var rects = principal.getClientRects()[0];
var topFinal = rects.top;
var bottomFinal = rects.bottom;
var bottomActual = elementIntoDiv.getClientRects()[0].bottom;
if (bottomActual == 0)
{
return;
}
while(bottomActual>bottomFinal||bottomActual<topFinal)
{
var direction="down";
if(bottomActual<topFinal) direction="up";
principal.doScroll(direction);
bottomActual=elementIntoDiv.getClientRects()[0].bottom;
}}
It worked in my enviroment, i hope it could be useful for you too.
View 4 Replies
ADVERTISEMENT
May 17, 2010
Is it possible to use scrollIntoView onload? I know how to use it onclick, but I can not find out how to use it onload. Is it possible? And if it is, what would be the correct syntax?
View 3 Replies
View Related
Apr 21, 2011
I working on a project for a client and I need a javascript event to fire the scrollIntoView method to pan the browser to a DIV element at the bottom of the page.
My function is as follows:-
Code JavaScript:
function jumpToOtherProducts()
{
var x = document.getElementById("product_canvas");
x.scrollIntoView(true);
}
Ive tested this in FF, Chrome and Safari and works fine, but not IE8. what I can do about this?
View 2 Replies
View Related
Jun 15, 2009
I've got a text area with a vertical scrolldown bar. Using the following JS code the text area scrolls down as I'd expect:
document.getElementById(ID GOES HERE).scrollIntoView(true);
But the main are also scrolls down - is there any way to stop the main page scrolling down too?
View 2 Replies
View Related
Mar 16, 2010
I have been using RHS, but in IE, it sometimes doesn't work the way I expect. Also, last update was a long time ago.
So, does anyone know better alternative for RSH?
View 3 Replies
View Related
Jul 23, 2005
Currently I use an onbeforeunload method, to do call various tidy up
methods when a user exits my web application - however I now need to add
additional support, for users migrating to Sun's JVM.
My understanding that the onbeforeunload call is a Microsoft one, and
the net result of having it in a page used by a SUN JVM user is that the
browser does not close.
Does anyone know of an alternative to this method, that is supported
by Sun's JVM?
View 4 Replies
View Related
Sep 30, 2005
In my webpage I have an embedded Windows Media Player and an unordered
list with a table of contents.
When playing a video, the Windows Media Player is triggering events for
new 'chapters'.
The corresponding chapter in the unordered list is then highlighted
with css.
The list can contain up tot 100+ items. Because the page itself should
fit the screen without scrolling, i put the list in a scrolling div.
I also want the div to scroll automatically in order to keep the
current chapter inside the visible scope of the div.
Right now i do this by initually creating an anchor for each listitem.
When an chapterswitch event occurs i scroll to the corresponding
chapter with the folling line of Javascript code:
window.location = "#" + ListItemId;
There is one problem; the annoying tick sounds in IE. For my
application it is not rare to have 25 'chapters' switched in one
minute, so that's an awful lot of ticking.
I was wondering if it is possible to automatically scroll up or down to
a specific point in a div without the browser making any sounds.
View 3 Replies
View Related
Jul 20, 2005
I was wondering if anyone can help me? I am having some problems wit
the <noscript> tag.
I actually use it to block banner advertisements from being displaye
in my website. I have used it at the <body> tag section and look
something like this:
<noscript>
<body>
</noscript>
What it does is stop the banner advertisement offered in most fre
websites from loading.
My question is how come it does not stop the banner from loading if
was to view the webpage in my Pocket PC using Pocket Internet Explore
Pocket IE)?
Everytime I load the page in Pocket IE, it displays a standard banne
that is found in all pages viewed using Pocket IE. I looked around fo
some answers and I found out that Pocket IE found in the Pocket PC 200
does not support the <noscript> tag.
Is there another way around this? I have written some pages that wil
load in my Pocket PC and I find it very annoying to see the banne
advertisement at the top. Code:
View 2 Replies
View Related
Feb 28, 2011
Is there an other way to link to an element on the same page without using anchor URLs?
View 18 Replies
View Related
Dec 7, 2006
I was wondering if there was an addLoadEvent alternative, that could be used before all images are loaded? I think it's something like when the DOM is ready...
View 1 Replies
View Related
Aug 29, 2009
this is the code I'm working on:
Code:
var tabs = new Control.Tabs('menu');
var pattern = 'tab=';
var nStr = location.href;
if(nStr.match(new RegExp (pattern,'gi'))){
var id = nStr.split(pattern);
[Code]...
It searches for the query string 'tabs=' and then splits the result to get the id of the tab. Then it uses this to set the active tab. If the url doesn't include the query string it set the tab to the first one.
The code works but it uses Eval to convert the id string (id[1]) to a variable and I was wondering if there was an alternative.
View 2 Replies
View Related
Jul 23, 2005
Is there a more concise way to do something like the the
desired code below?
The gripe is with the try-catch syntax. It takes *way* too
many lines of code to evaluate a conditional expression
when zero or more parts of the conditional expression may
trigger an error. In this case, the trigger is a call to
a non-defined (null) object.
In other words, how can you do a more simple 'try' statement
that simply spits out true or false, depending on whether
the 'tried' code threw an error or not?
Defining a function don't seem to work because you
can't pass the 'try' code as an argument. Extending the
'Global' constructor is not an option, so now what? Code:
View 3 Replies
View Related
Jul 23, 2005
Is there a possibility to do a string replace in javascript without regular experessions. It feels like using a hammer to crash an egg.
View 24 Replies
View Related
Jan 28, 2006
I'm working on integrating the a javascript wysiwyg editor (Xinha) with
my blog software (ExpressionEngine, aka EE). EE has extensions now so
it's easy to get the Xinha header code into the head section of the EE
web page.
But Xinha likes to use an onload command to launch:
window.onload = xinha_init;
....and EE is already using the onload command in the body tag of the web
page:
<body onLoad="document.forms[0].title.focus();set_catlink();" >
The onload command in the body tag is keeping the window.onload command
from working. At this point EE doesn't let extensions modify the body
tag.
Is there an alternative way to run the xinha_init command, without using
the window.onload command?
View 3 Replies
View Related
Apr 12, 2007
I have a query on browse button, In my page , i want to upload
files , But i dont want normal <input type=fileto be used for this,
so can anyone tell me anyother alternative solution for this ,
Here I have a button and textbox, if i click the button, it should
popup a file upload dialog box ,after selecting a file, that path
should be pasted in that textbox...
View 2 Replies
View Related
Jul 20, 2005
I want to use an anchor tag to invoke some javascript and I've read that it's bad form to use <a href="javascript:foo()">
I've read endless usenet posts and hint sites on the net, they all suggest different things and I can't get any kind of consistency, and I can't find any solution that works properly for IE, opera and mozilla.
many of the recommended solutions go something like this:
<a href="javascript:void(0);" onclick="foo()" />
this generates an <a> that looks like a hyperlink (good) and it invokes foo() as well (also good). the problem is that if in function foo, I put
window.location.href = "some new url";
it just seems to get ignored. If I miss out the href altogether, the link works but it's not formatted as a hyperlink.
All I'm trying to do is make something that looks like a normal hyperlink but whereby I can build the URL with some javascript rather than having it coded into the HTML, and I have to say it's driving me mad!!.
View 6 Replies
View Related
Oct 5, 2010
I'm looking for an alternative for .closest(). My script refers to jQuery 1.3.2 which is not the latest, but does its job. By trying to implement my code into another script I noticed that this script uses jQuery 1.2.6. Well, 'changing that version was no option'.[code]This is my code. It should be used to clone special comments containing "In[" and in some cases "text".Unfortunately .closest() doesn't work out for me. i'm looking for an alternative.
View 1 Replies
View Related
Jul 14, 2010
Is there a javascript or jquery effect which can simulate the effects in flash shown on this page : http://www.macrolane.fr/Temoignages/Effects are on mouseover and mouseout on the squares
View 1 Replies
View Related
Jan 28, 2009
my website tag7.ch consists of an html entry page and the main website. on the entry page there is a js menu that opens the main webpage in a new window in full screen. I love this function but browser that dont allow js doesnt have a chance to enter the main website.Do you know how the script has to be changed that there will be displayed some simple html text-links for non-js browser?greetings from switzerland,marcuswww.tag7.ch
<head>
<SCRIPT LANGUAGE="JavaScript">
function openPage(page, width, height, sBar) {
[code]....
View 4 Replies
View Related
Jul 26, 2010
I have this code http://www.jsfiddle.net/Nntc7/ created by a pdf publisher, I need to offer non flash content to users but dont know javascript and I cant get the thing to work using swfobject, How do I edit this to allow for alternative content??
View 4 Replies
View Related
Mar 29, 2006
I am currently recoding my website to perform more efficiently. By performing more efficiently I mean that I will be recoding the server side mostly.
One Particular idea I had was for select boxes. Right now for a page that lists the information for a user (say country of birth for example, which has over 200 option values) the php has to print all the values of the countries in a loop as <option></option>. The reason why it has to print them out each time is because it has to select the users country name.
Considering that there are 200+ values and there are also about 8 other select boxes that also have their information to be selected and printed thru php loop, it can get to be quite a strain on the CPU (when a bunch of users are all doing it).
So I decided to use a javascript function for each box to select the correct option value to be selected according to what the user has chosen beforehand. It generally is the same thing only the client is doing the job and not the webserver.
So what I am asking here is that should I reply on the javascript to do this? I have the paranoia that there will be some occurances where the client doens't have javascript or the version of javascript wont support the DOM features that are used to perform the job.
So for the average browser to be doing something like this, should I still be worried about this or should I go back to using the server side to handle the selected box values???
View 2 Replies
View Related
Feb 9, 2010
I need to detect the "name" of the constructor of an object. For example, myArray.constructor === Array is true, but I want something where that === 'Array' is true. I've heard of Object.constructor.name, but it's not widely compatible. (preferably without involving regular expressions)?
View 4 Replies
View Related
Aug 6, 2010
I am retrieving an XML document like the following:
<SampleData>
<contentContainer>
<div>HTML goes here</div><div>HTML goes here</div>
</contentContainer>
<moreRecords>1</moreRecords>
</SampleData>
I was using a statement like this to take the content out of the "contentContainer" element and place it into another element:
$('#myDiv').html($(newXML).find("contentContainer").html());
This works great in Firefox, but doesn't in IE. I can use the following in IE using the text method, but that doesn't do what I want:
$('#myDiv').html($(newXML).find("contentContainer").text());
It appears that the html method isn't available with XML. Is there an alternate method I can use to grab a whole chunk of HTML within a portion of my XML document?
View 1 Replies
View Related
Jun 18, 2009
So I have a set of <SELECT> elements that are ajax'd in and out depending on what is selected using the event "change". I know that .live("change") is not fully supported.
View 2 Replies
View Related
Apr 23, 2010
The code works, but it obviously can't be used for more than one picture per page because getElementById finds the first div and always displays it onmouseover of any attempted mouseover text.The Javascript in <head> is
<script type="text/javascript">
// Pop up code begin
function ShowPopup(hoveritem)
[code]....
So the display code is
<a id="hoverover" style="cursor:default;" onMouseOver="ShowPopup(this);" onMouseOut="HidePopup();">text here</a>
<div id="hoverpopup" style="visibility:hidden; position:absolute;"><img src="url here"></div>
I just want to be able to have more than one instance on each page and still be able to declare the image url in the body and not within the javascript.
View 8 Replies
View Related
Apr 17, 2003
I often script-compile CSS, like:
var sty='<style type="text/css">'
+ 'p { color:red; }'
+ '</style>'
document.write(sty);
How can I do that without document.write?
View 15 Replies
View Related