Unobtrusive Fixed DIV For All Browsers
Mar 3, 2010
First off by let me stating that I am not a great web devloper nor am I a good with css / javascript. I am creating this website for a friend of mines company and I have one problem.The problem is that the navigation menu on the right side will not remain fixed how i want it to be. I spoke with many people and they all said that this cannot be done with css considering your layout and because it needs to dodge the headers and the footer. I basically want this div (sidenav on the right) to scroll along the page as users scroll up or down but it can not interfere with the header or footer. I do not want the right side navigation to go over the content or out of the wrapper. I want it to stay in the same position in all aspects - left / right / top / bottom. Here is a link to the site [URL].
View 2 Replies
ADVERTISEMENT
Sep 26, 2009
Why this code is not working on Webkit browsers:
Only jquery and the plugin printed above are loaded, so there shouldn't be any conflicts.
HTML:
Chrome gives the following error: Uncaught TypeError: Object #<an Object> has no method 'followUser
View 10 Replies
View Related
Jan 24, 2007
Is it possible to write this as and unobtrusive script in the head of a document?
This is a really long piece of code for being in the html!
<a href="whatever" onmouseover="document.images['s3a'].src='hover.gif'" onmouseout="document.images['s3a'].src='root.gif'" onmousedown="document.images['s3a'].src='active.gif'" onmouseup="document.images['s3a'].src='hover.gif'"><img src="root.gif" name="s3a" height="50" width="50" alt="" border="0"></a>
View 2 Replies
View Related
Nov 12, 2009
I have a PHP page that dynamically generates table rows with input fields. A sample row looks like:
Code:
<tr id="row1">
<td><input type="button" name="remove_row1" id="remove_row1" value="X" /></td>
</tr>
I have a JavaScript function that I am attempting to attach to each of the input buttons:
Code:
// get all the input elements
var inputs = document.getElementsByTagName('input');
var delete_regex = new RegExp('remove_row');[code]...
But I would like to give it a parameter
Code: inputs[i].onclick = delete_row('row' + inputs[i].id.replace('remove_row', ''));
But doing the above just executes the function. What is the best way to do this?
View 2 Replies
View Related
Oct 16, 2007
I have been going back and getting rid of so many of my onclick's and such, trying to switch to a more unobtrusive method of adding events to anchors.
I've run into one snag that's kind of dissonant for me, and wondered if anyone had any advice.
By adding an event, you can turn:
<a href="#" onclick="something(); return false;>Click me</a>
Into:
<a href="new.html" class="something">Click Me</a>
But what goes in href if you don't have anything to actually link to? One example is a page I've written that is entirely self-contained, and all href's that drive the interface end up pointing to #. Is this acceptible in edge cases like these with the unobtrusive approach?
If someone has JS turned off the markup is essentially meaningless, so I was wondering how people deal with this lapse in the separation between behavior and structure.
View 2 Replies
View Related
Jul 11, 2009
I'm working on implementing an unobtrusive javascript where I use code instead of an HTML hook to call a function.
Old way: <input type="text" name="username" onBlur="javascript:function();" />
Now I have changed it to:
window.onload = function()
{
if(document.getElementById("username"))
{
var usernameInput = document.getElementById("username");
usernameInput.onblur = checkUsername('username','ajaxResponse');
}
}
which is placed in the body section of the page. Anyhow, my problem is that it works fine, but only once, right as the page loads. I have tried removing window.onload, but then it doesn't work at all. How can I get this to work every time I blur from the text field?
View 1 Replies
View Related
Jan 10, 2007
I've got the following code in a website of mine:
Code:
<a href="section1.htm">Section 1</a>
<a href="section2.htm">Section 2</a>
<a href="section3.htm">Section 3</a>
<a href="section4.htm">Section 4</a>
<div id="general">General overview</div>
<div id="section1">Section 1 overview</div>
<div id="section2">Section 2 overview</div>
<div id="section3">Section 3 overview</div>
<div id="section4">Section 4 overview</div>
I want to display the div marked 'General overview' by default, and to hide all of the other divs (section1, section2, section3 and section4) but would like to swap out the 'general' div with the other divs as the corresponding links are moused over.
e.g. mousing over the Section 2 link will replace the 'general' div with the 'section2' div. On mousing out, it will revert back to the 'general' div. Mousing over the Section 4 link will replace the 'general' div with the 'section4' div. On mousing out, it will revert back to the 'general' div. Etc etc....
View 11 Replies
View Related
Jul 10, 2007
I was reading through a book that talked about unobtrusive javascript, and it gave this example of how to trigger a function instead of using an inline onmouseover event handler.
document.getElementById("RandomElementId").onmouseover=RandomFunction;
I thought this would be cool, but I can't seem to find a way to pass parameters to the function this way. I assumed you just use RandomFunction(parameter1,parameter2); but no go.
Is there a different syntax for this, or does this technique forbid using parameters?
View 3 Replies
View Related
Jul 12, 2009
From my understanding the main feature of unobtrusive JavaScript is to remove event handing from the markup.The main reason for doing this is to avoid repetition of code.There are also other reasons but that is the main one. e.g. no having to write <tag onclick="function()" > over and over again. This traditional event handling method makes code less maintainable.However is it worth writing unobtrusive code when we consider the following:
1, Server sider scripting laguages can be used to avoid code repetition. e.g. we can use a loop to add multiple onclick event handlers to all the elements of a navigation list. Thus we would only have to write onclick="function()" once.
2, Unobtrusive coding makes the code harder to follow.It is easier to look at the markup to find out what happens when an event occurs on an element rather than having to look through wades of JS code to find the correct event listener. This is especially true when a team is working on a project. It is easier to find out what another person has done when the traditional model of event handling is used.
3, Unobtrusive coding means longer and more complicated code. Also there there is a need for having to deal with browser differences.I know this can be reduced using libraries such as JQuery. Is it worth using such a library?
View 2 Replies
View Related
Nov 16, 2009
Does anyone know how to make the cycle function in jquery unobtrusive?
I've got the following code and when I disable javascript, I get a nasty long list of images :(
Jquery code:
Html code:
View 1 Replies
View Related
Mar 19, 2011
without outside extensions (http://remi.org/2009/01/06/using-firebug-to-debug-unobtrusive-javascript), how does one debug javascript events on a webpage that primarily relies on unobtrusive JS events? for instance, i have a website i log into that has a "submit" button. the button itself only has this code:
<input type="image" class="png" tabindex="5" value="Go" src="login.png">
obviously, the only way that it can submit the form is to use javascript. and it's obviously unobtrusive in this case.consider the fact that it isn't my webpage, and i don't want to try to put random breakpoints everywhere blindly.
View 4 Replies
View Related
Aug 9, 2005
I have an old web application I did where browsers with dynamic
capabilities received a drop down menu on the top of the page and a
fold out on the left hand side of the page and non-dynamic browsers
received two static menus. This was done via server side detection of
browser capabilities and branching the application. Over time needless
to say the capabilities between the dynamic and static sides got
seriously out of whack.
Now the drop-down menu was not done unobtrusively, it was done via
mouseovers and the like.
Obviously it makes sense to change the menus to be done by catching
events. But I would also like to redo the dynamic and static branching.
The way I figured would be as follows:
The static menus are placed inside of noscript elements.
The dynamic menus are loaded with display set to none. Script writes in
a new css changing dynamic menu display to block.
As I understand noscript is considered bad via unobtrusive javascript
theory, however I have a hard time seeing how one could make a menu
that would display properly as a static menu yet also function as a
drop down or fold out (especially fold out), collapsible expandable
menus are easy since they basically have the menu order placed in the
structure needed.
So I'm wondering if anyone has reasonable suggestions on how to
succeed.
On another subject, anyone know what the effect of a bunch of links
inside a noscript element that mirror a bunch of links in the normal
page will do to Google's algorithms?
View 2 Replies
View Related
Nov 3, 2010
I am trying to create a basic unobtrusive form validation function but I am having some issues/questions. Basically I am checking if any of the form fields have <= 3 characters, and if they do so, then I make those fields' backgrounds and borders red. Also in the empty <span> tags I insert an error message. My issues/questions are:
#1: So when I say if (fieldVals<=3) this means that the errors should appear if the values are 1,2 or 3 characters long, right? It does not do that though, when I insert one character in any of the form fields the errors go away, but they should not, right?
#2: How do I cancel the form from submitting if errors are visible and vice versa? When I use the return false when errors are visible, the code does not even run. What is going on? return true does the same.
#3: When I use a submit button(type="submit") instead of just a button(type="button"), the code does not run? What am I doing wrong?
I am not trying to use this on a website, I am just trying to learn how to use unobtrusive javascript. That's why I am only checking for empty fields. If I learn how to do this first, later I will try to add email check, date check etc.
THE CODE:
View 12 Replies
View Related
Oct 10, 2011
I have a simple button in my HTML. I also have a function in my external JavaScript file. This function calls an alert box with some text. Now, I also have a global variable in my JavaScript that gets the button by id, then assigns the onclick event handler to it which in turn is assigned the call to my alert box function. Simple right?
Problem: The alert box shows up when the page loads as well as when the button is clicked. This is not desirable. code...
View 14 Replies
View Related
Jan 12, 2006
I have a div with headers. Of course, when there are too many rows, you have to scroll and lose the headers of the form. How can I accomplished "fixed headers?" so that they're always visible?
View 7 Replies
View Related
Apr 2, 2007
I'm having an issue with a problem with Javascript on my website. Please note I didn't create the javascript someone else did a long time ago and I'm using it with their permission and they are no longer on the internet or in webpage ways.
The basic problem is that these pages work just fine in IE6 and IE7 but with Firefox 1 and 2 they work but not as they are suppose to. Code:
View 4 Replies
View Related
May 13, 2006
Anyone know how to make an svg circle radius fixed (i.e. not affected
by transforms)? I tried adding px or cm, e.g. r=ཋpx' but it just
generates an error.
View 3 Replies
View Related
Aug 23, 2006
what im trying to do is get a paragraph tag to display like a textbox
but put links in there which can be clicked on. (so a textbox wont
work). i want each <pto have the same length (regardless of link
length) so they line up ok when placed in rows.
is this possible?
here is my styling so far of the <p:
style='padding:none;margin:0; display:inline; width:100px;'
this gets the p on the same line as the other stuff (which i want) but
can get the width to work?!
View 12 Replies
View Related
Jan 14, 2006
I only have a table that is a fixed height within which to place a menu of links.
There are more lines of links than will fit in the table. So i need to have ascroll bar on the right within the table to access the rest of the links.
I have played with code for drop down menus and opening in frames etc, with no real problem, but in this instance i have to display them in a fixed size table, can anyone point me in the right direction.
View 3 Replies
View Related
Apr 1, 2009
I have a "Roaming Companion" on my sites index page (www.studylinks.org - look for the red R) and I would like to fix its size and disable the expand and maximize functions. I assume it's in the Java rather than the HTML or CSS but do tell me if i'm wrong.I'm new to the forum so please forgive any posting/etiquette errors on my part. Javascript Document
function doPopups() {
if (!document.getElementsByTagName) return false;
var links=document.getElementsByTagName("a");
[code]....
View 2 Replies
View Related
May 27, 2009
I'm using this script above the </body> tag in a CC instead of using IE expressions to fake position fixed in IE 6.
Code JavaScript:
<script type="text/javascript">
window.onscroll = fixedIE;
[code]....
View 8 Replies
View Related
Oct 8, 2011
I just thought this might require some javascript, so I posted this here. Anyway, how do I create an element that is absolutely positioned first, and then, when it goes to the top of the page, it becomes fixed?
View 13 Replies
View Related
Dec 23, 2010
I am trying to have a sidebar that has a fixed position so it scrolls with the page, but can be hidden (toggled) like this: only on the right side of the pageI am going nuts trying to figure this out: I've tried dozens of scripts but everyone has problems working together
View 1 Replies
View Related
Sep 26, 2011
I'm having a problem with css positions !! i want the position of an image to be fixed when the user scrolls till some point and the position should be set to relative after that
View 9 Replies
View Related
Feb 12, 2007
I have a <img scr="mypic.jpg"in my html. I would like to display the
image by width=200 if the image width is larger than 200. I also would
like to display the image by its real width if the image width is
smaller than 200. How can I do it?
View 7 Replies
View Related
Feb 23, 2007
I've written a small javascript library to help automate Ajax requests
and the like. One of the things I want the library to do is display a
"Please wait" indicator in the upper right hand corner of the viewport
while requests are processing.
What I do is append a div element to the document body, set it's
position to fixed and set the top and right to 0. This works great in
Firefox and Opera, but not in IE.
var processing = document.createElement('div');
processing.appendChild(document.createTextNode('Pr ocessing...');
processing.style.position = 'fixed'
processing.style.top = 0;
processing.style.right = 0;
document.body.appendChild(processing);
In IE this element displays in it's normal position (at the bottom of
the page) as though it has a position: relative or position: static.
I've seen tricks using css and things like height: 100% and overflow-
yL auto, but these never seem to work when I try them
programmatically. And because I may want to distribute this, I don't
want to require that the end user go through any gyrations for ths to
work.
View 1 Replies
View Related