JQuery :: Outline Html Elements On Hover And Click ?
Jun 15, 2009
Trying to make code that adds a hover event to all html elements within a certain container. On hover the element should be outlined by adding/removiing a css class. Thats the first thing and I can't get that to work with the code below.
The second part is to keep the element outlined when its clicked, and also when selecting multiple elements by (ctrl+click).
Have searched for a outline plugin, but came up with nothing.
View 4 Replies
ADVERTISEMENT
Jul 26, 2010
I have a page that inserts a div after another div on my page. Basically this div and its content are generated by the server and outputted via Ajax when the user clicks a button.I have something like:
//Listener function
$("div").click( function () {
alert("thing");
});
Clicking any of the divs that were loaded on the page will give this alert however, clicking on this div that was inserted after the user clicks a button does not respond to this listener. I put my rendered html into the w3c validator and my page has no errors (because I thought that maybe I had a missing end tag which would cause jquery to not work).
View 1 Replies
View Related
May 4, 2010
I have this script that will read all the headers (h1-h6) in your HTML document and also HTML comment tags which are specially recognized, and it will create an HTML document "table of contents" (or outline) and insert it as a DIV within the document. This is for people with ESPECIALLY LONG HTML documents...it makes sense for this purpose.
The script is attached to this post in a zip. The zip archive has four JS files. 'htmlTOCgenerator.js' has all the meat of getting the nodes and generating the DOM nodes for the ToC. The other three have 'support' functions and are included. The 'colorContrasting.js' file is actually supposed to compute 'complementary' colors from random color generation. Why? Refresh the document each time, and the ToC has a different foreground (text) and background color, that's why. Breaks up the monotony. A large comment block inside 'htmlTOCgenerator.js' tells the document maker how to set up the HTML document for making this work.
In a first version, this script inserted the ToC ('table of contents') at the top of the document where the HTML comment tag "<!-- putTOChere -->" was placed/found.
Then I decided it was better to place the ToC DIV element to the left of the text, in a fixed block (does not scroll with text). The ToC DIV contents themselves are scrollable in case the contents would go beneath the bottom of the client window height--can't have that.
Click here to see an example of how it works:
I am having problems with it though.
1. The scrollbar on the ToC block always shows, even if the contents don't fill up the block. The CSS is set for 'overflow-y:scroll' but that does not mean the scrollbar does not show if there is no overflow. It would be nice to control that. Still have not figured it out.
For an example of not enough headers to fill out the height-specified (by necessity) fixed DIV block, see this page.
2. In my documents, the main body of text is all wrapped in a DIV with its right- and left-margins set to 'auto', so that when user widens or narrows the client window, the text is always centered. I need to stop the main body text from running behind the TOC during a narrowing of the client window. I thought setting the right margin of the ToC DIV should stop that. Anyway, that is a CSS styling problem, I suppose, although the CSS must be set through script (I do through script since the instructions don't require the document maker to set up CSS: too many instructions become annoying for anyone wanting utility in the script). And if you think frames are answer, that complicates matters and I believe it gets away from the eventuality when frames are deprecated.
3. I also want criticism on how to make this presentation/structuring/interaction of the ToC block better or workable.
View 1 Replies
View Related
Sep 9, 2010
Im trying to get 2 elements to execute some effect individually at the same time on a hover.Ive looked at .animate but if I understand it correctly I can do multiple effects but still limited to that single element.[code]So basically Im just trying to get 1st & 2nd on hovers to happen at the same time and 1st and 2nd off hovers to happen at the same time.
View 1 Replies
View Related
Jan 24, 2011
Is it an easy transition to change a block of code from a hover effect to a click effect? This is the block I'm using:
[Code]...
View 1 Replies
View Related
Apr 21, 2010
I have a grid that uses RowAltRow as the classes for the rows...is there a way to have the hover applied to both instead of having to define it twice (or more)?
[Code]...
View 2 Replies
View Related
Feb 18, 2010
I want to animate a button with .hover and then animate it even more with .click. The problem is when the button is clicked, the mouse is no longer hovered so the hover returns to the default position. I need to stop the .hover from returning to the default non-hover state when the button is clicked.
Hover Code:
$('#about-btn').hover(function () {
$('#about-btn').stop().animate({
marginLeft : 27
[code]....
View 4 Replies
View Related
Jan 23, 2011
I've run into a problem with swapping images for site navigation.The "hover" part works just fine, but the problem lies within the click part. When the user clicks the first thing that happens is to reset all of the images for all of the links, and then set the hover image for the link that was clicked. However it seems that after resetting all of the images 'src' attributes, the code for setting the link that was clicked either doesn't execute, or executes before the reset.
View 1 Replies
View Related
Apr 8, 2011
I have no idea if this is even possible, but I thought I'd check here to see what anyone thinks.I have a top nav on my site that has dropdown submenus. When a user clicks on one of the sub-menu items, jQuery toggles a div in the main content area to be visible.The problem is that since I am using CSS hover menus, the menu remains over top of the div that was activated in the background.I know that I could do a normal page load instead of show/hide this div, but I'm wondering if there is another way. Before I go another direction, I wanted to see if anyone had an alternative.
EDIT: Maybe something using .focus()? But then maybe I need to rebuild my menu to allow this, because simply adding focus to the div doesn't seem to do it.
View 3 Replies
View Related
Jul 16, 2009
How can I remove the hover event in jquery after the click event is triggered...?
jquery:
Code:
$('li').hover(function(e){
},function(){
});
[Code]...
View 3 Replies
View Related
Sep 5, 2011
The aim is a roll over button. It works on hover, and shows the two images however I can't seem to make them link to their individual pages. First question, How do you put in the a href code correctly? Maybe I'm using the wrong formula although I've reasearched heaps of other alternatives and I just can't seem to make it work.Second question, Anyone know how to bind this all up intoa simplier code?
[Code]...
View 2 Replies
View Related
Aug 17, 2009
<a href="http://jqueryui.com/demos/sortable/#connect-lists">http://jqueryui.com/demos/sortable/#connect-lists</a>
I was wondering if anyone knew of code like thisĀ that handled embedded lists that would work like an Outline
View 1 Replies
View Related
Sep 5, 2009
I'm trying to figure this out with jQuery: I have a few paragraphs of text kind of like this:
<p class="original" id="paragraph_1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ut metus augue, vitae malesuada massa. Vestibulum nec lectus urna, vehicula porta leo. Fusce dui nunc, scelerisque at molestie ut, ultricies eu purus. Duis tristique placerat rhoncus. Aliquam rhoncus lacus justo. Morbi ultricies egestas orci eget fermentum. Proin sapien sem, suscipit vel semper in, tincidunt id enim. </p>
<p class="text" id="paragraph_2">Maecenas nisl ipsum, faucibus sed pulvinar a, tristique sed magna. Sed dui erat, tempor ut rhoncus sagittis, lacinia quis lorem. Quisque feugiat, ipsum nec varius elementum, est nunc lacinia mi, mollis convallis lorem ipsum at erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
And I have a couple of classes, like so:
.highlight {
background-color: #ccc;
} .strikethrough {
text-decoration: line-through;
}
What I want to do is apply the .highlight class to a sentence (not the entire paragraph) on hover, and apply the .strikethrough class to a sentence on click. It's easy to find a sentence using regex, but I don't know how to add/remove a span to just that particular sentence that is being hovered over. I know I could programatically wrap each sentence in <span>...</span> tags on the backend, but I was hoping there was a better solution.
View 1 Replies
View Related
Jan 18, 2011
How do i make it so that when there is an event insidean iframe on the page, it affects and can call a function from the outerpage? (that houses the iframe
View 1 Replies
View Related
Jul 28, 2011
I want to change the content of different div's using .html(). The change should be done by clicking on the inner element of the container. The content of the clicked container should be changed with the first container. My problem is, that the following code does the change, but only once. After every div has changed one time, no more reaction is shown.
<script type="text/javascript">
View 1 Replies
View Related
Jun 2, 2009
I've been looking for an "Ajax CMS" but decided to learn jQuery to learn how to code it myself in order to earn some geek-girl cred among my male colleagues. I've learn a lot about jQuery in a week but as you can imagine I still have a lot to learn.
I have successfully animated an image (move to the left and increase opacity) when the mouse hovers a div and reset the image (move it back to its original position and reset the opacity) when the mouse move outside the div. So far so good...
Here comes the question: What I need to do -and don't know how to - is when the user clicks on the div the image should stay in the hover position while still being able to hover any other divs and activate the animation normally.
When a different div is clicked the previous "Clicked" div should return (animate) to its original position and the new "Clicked" div should stay in the hover position. Content will be loaded when the divs are clicked but there won't be page refresh since I'm loading the content by using the load funtion of jQuery.
I'm including the code:
View 1 Replies
View Related
Jul 23, 2005
Problem I began with: Netscape/Opera supports hover for different elements,
IE only supports hover for <a> and I want to use hover for <td class="menu">
I then found a fix using some Javascript here:
http://webpages.charter.net/mmmbeer...rbitrary-hover/
It works ok for IE now.
Problem I now have: I don't want the script to run in a browser that does
support hover for <td>.
In other words I noticed that the script was still running for Netscape and
Opera - but I would prefer to let those browser's native hover support to
work since I notice that in some cases the script can introduce lag at
loading time.
I don't want to sniff for IE: I know how unreliable browser sniffing is. I
would rather sniff for the lack of hover support.
View 15 Replies
View Related
Jun 3, 2010
I have HTML tags stored in XML. I want to be able to use these HTML elements with Javascript, just as you can with elements in document.body. How can it be done? (And don't try and tell me I should use server-side because I have written it all for Javascript and the project is nearly complete minus this and there are practical reasons for not doing this server-side. After all, anything is possible with Javascript!)
Let me explain:
- I have HTML templates such as this [URL]
- I want javascript to populate these templates then add them to my page
- The only way I know javascript can get this kind of data is by parsing XML
- I want to parse the XML then be able to use the HTML elements just like those in document.body
- As far as I'm aware, XML is the only good way of storing data for javascript. I don't want to store it in javascript variables (too much multiline data with " and '). Nor do I want to build it using document.createElement("div")... etc
As someone not yet with any experience in computer science etc, please ignore my poor terminology! However, I'm not a beginner when it comes to javascript.
Here's the script concerned but I doubt it'll help you understand my problem: [URL]
View 6 Replies
View Related
Mar 23, 2011
This is what I'm trying to do: I want a simple image container to swap the image inside it by clicking the nav buttons on the right like 1, 2, 3.Here's my code:
HTML
Code HTML4Strict:
<div id="item1">
<div class="img-container shadow" style="background-image:url(images/gallery/tcg1.jpg)">[code].....
My jQuery code is not right. I want it to turn off the "hover" class and the "show" class of the others when you click one. I think I need some kind of if..else? how to write it? I have a bg image set on the container div so there's an initial image to view.I also need multiple of these on the same page!
View 1 Replies
View Related
Jun 7, 2009
I currently have this (Using jQuery):
My problem is that when I hover over info1 and one of its sub elements (p or a), it activates the onmouseout effect. Only though when I cross that invisable box line that surrounds them.
So the effect is this constant mouseover/mouseout effect when I hover over the sub elements (Once I hover over the sub elements, img1 shows, but then I mouseover that so info1 starts to show).
View 4 Replies
View Related
Feb 15, 2009
The following script produces a box that opens on mouseover and closes on mouseover.
Code:
$('#triggerReg').hover(function(){
// do something on mouse over
$('#menuReg').show();
[code]...
It works fine for displaying brief text messages. But if you display a column of links, it closes as soon as you try to put the cursor over a link. how to modify this so that the menu stays open until you manually close it again? I changed hover(function() to click(function(), and it now opens when you click it - and it stays open. But I can't figure out how to close it.
View 1 Replies
View Related
Jun 24, 2011
$("#next-artist").click(function() {
$.get("img/home1.png",function(html){
$("img#artist-photo").replaceWith(html);
}
});
So this code isn't working.
View 3 Replies
View Related
Jun 13, 2011
Below is a simple page where a click loads a div. The contents loaded are a few paragraphs. What I'm looking to do is, after the user loads the div 'remotecontent' by clicking "click here to load", that he will be able to click on one of the paras in that div and have the contents of that para displayed in the div 'respondtoremoteclick'.
<html><head> <script src="jquery.js"></script>
<script language=Javascript>
function loadremotecontent() {
[code]....
View 4 Replies
View Related
Nov 25, 2011
I'm using a feature carousel on my new website - this is a horrible test version but take look and you'll see my problem - [URL]... It works fine in Chrome, FF and IE9 - however in IE8 and IE7, on the fade, an ugly black outline is added to the transparent PNG.
Does anybody know how I can remove the black outline in IE8 and IE7.
View 3 Replies
View Related
Jan 24, 2009
I'm using DreamWeaver CS3's image rollover code, but I'm trying to edit the code so that when you click the image, the hover state stays selected.
Then, when you hover anc click another image, the first image reverts back to it's original state. I've scoured the Internet, but can't find anything that works.
Here's the current javascript code:
Code:
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
[Code].....
View 1 Replies
View Related
Jul 15, 2009
I'm working on creating a little suggestion/autocomplete code for form fields.[code]...
Everything works fine and when I click on the text Foo the form field value is set to foo. But, when I try clicking on a word added to the page by the keyup part of my code above it doesn't work.
View 3 Replies
View Related