JQuery :: Anchor Links - Toggle Need To Clicked Twice

Feb 25, 2011

I basically have many anchor links where when I click each of them it slidesdown its own div with some text in it. So have I wanted is when I click on one link it will show me the current one and hide the others. This is what I have tried which works great but when I click on a link it opens the div, then click on another one opens the div with one click and when I go back to re-click the previous link I have to double click it in order to work..

This is my js code:
$(".anchorlink").toggle(
function() {
var cont_val = $(this).attr("id");
$("div#unique_anchor_text", this).show();
$("div#unique_anchor_text").hide();
$('.unique_anchor_text'+cont_val).slideDown("fast");
},
function() {
var cont_val = $(this).attr("id");
$('.unique_anchor_text'+cont_val).hide();
});

HTML looks like:
<a class='anchorlink' id='$item'>Comment</a>
<div id='unique_anchor_text' class='unique_anchor_text$item'>some text</div>

View 3 Replies


ADVERTISEMENT

JQuery :: Reload Page With Anchor When Anchor Link Is Clicked?

May 26, 2011

I need to get the page to reload with the anchor in the link when it is clicked in a dropdown menu. For example if I am on 'www.domain.com/about/#2' and I then click on 'www.domain.com/about/#3' the url changes but the page doesn't reload so I need the page to reload, but keep the new anchor (#3).I gave the links with anchors a class of 'reload' and tried this:

$('a.reload').click(function() {
window.location.reload();
});

View 4 Replies View Related

JQuery :: Getting Attributes From Clicked Anchor?

May 7, 2010

oing through my learning curve now. If I have my html (being generated by a PHP MySQL call) set up as such:

<a href="javascript:void(0);" class="clickable" opendesc="<?php print $thisid; ?>"><?php print $appname; ?></a>

so where opendesc will equal 1, 2, 3, 4...how can I pass this to jquery?I tried this:

$(document).ready(function(){
$("a.clickable").click(
function(){

[code]....

View 3 Replies View Related

JQuery :: Hiding List When Another Anchor Is Clicked?

Feb 16, 2011

This is my FIRST attempt at using Jquery to make a site menu for a client, and I'm pretty new to Javascript as a whole..I have a two column horizontal menu, and when an anchor on the left column is clicked it brings up a list in the right column..how do I hide list in the left column when a different anchor is clicked, bringing the new list to the top of the column?

<style type="text/css">
ul.nobulletnoindent {
list-style-type: none;

[code]....

View 2 Replies View Related

JQuery :: Perform / Execute So And So, When Anchor Element 'clicked'?

Jul 29, 2010

as you can tell by the following statements, i'm new to jQueryI'm trying to do the following (in plain english) without too much success.. ) when document ready.. 2) find the element with id 'next'.3) pull / take all 'li' elements, and perform so and so, all whilst excluding 'last' element.

$(document).ready(function() {
$('#next').click(function() {
$('li').each(function() { //for each li ..

[code]....

View 4 Replies View Related

JQuery :: Cycle - Put Links On Page Anchor Control?

Aug 6, 2010

all try to explain my problem: i have this website:[URL].. i'm using Jquery Cycle to do a slideshow. I would like to know how to put a link on each colored square.

I know i have to find in "jquery.cycle.all.js" but i'm a bit lost...

View 6 Replies View Related

JQuery :: Highlight Content Based On Clicked Anchor From Another Page?

Sep 30, 2011

I recently had a request from a client and I'm not entirely sure this is possible. I'll try to explain it the best I can, as I can't share the development files yet...

We have a page with an image map of the United States. If anyone clicks on a state, it will bring them to a new

page. This new page contains a table that has named anchors on it, each row being a different state.

So, for example, if someone clicks on South Carolina on the map page, they will be brought here[code]...

The #sc anchor will scroll the new page down to the row in the table about South Carolina.

Is there any way to highlight the table row that the person is looking for? For example, if they click on South Carolina, they will be brought to this new page and the South Carolina row in the table would be highlighted.

View 2 Replies View Related

JQuery :: Cycle: Anchor Links On Slideshow Images + Captions?

Sep 12, 2010

I'm creating a slider with the Cycle plugin and ran into a little bit of a road block.

What I want to do is simply have anchor links on my slideshow images, which I can get working just fine, except that when I add these anchor links, it removes my image caption (which worked prior to adding anchors on my images)

[Code]...

View 2 Replies View Related

Anchor Within A Hidden Div In A Toggle?

May 20, 2011

I have created a page using collapsible divs through a simple javascript toggle. This is the javascript:

Code:
<script language="javascript">
function getItem(id)
{

[Code]....

This page is a class listing and each toggle bar is a class category. What I want to do is be able to link from another page to the class page, but to a specific class listing within the hidden div section.

The actual page is: [URL]

note that I am working within the confines of a content management system.

I need something like: go to the page, do the toggle function to show the div, then find a page anchor to locate the correct class.

View 2 Replies View Related

JQuery :: Treeview: Using Links That Don't Toggle?

Jul 8, 2009

I have a treeview with links in that navigate to other pages when clicked. I didn't want these to cause toggling when they were clicked. My lists are prerendered. I didn't find a very good way to do this, but the following works, This function goes in the head, it is to stop the event bubbling up to the default treeviewcode. function lihyperlinkclick(e)

[Code]...

View 1 Replies View Related

JQuery :: Toggle Different Elements Depending Upon The Url When It's Clicked ?

Mar 25, 2011

I have a single page which uses tabs to segment the content. Alongside the tabs themselves is a button for 'Help'. I'd like this button to open a different DIV depending upon the tab that is currently being used.For example, if I am on a tab for 'Ben', if I click the 'Help' button I want the 'helpBen' DIV to slideToggle.If I am on a tab for 'Paul', when I click the 'Help' button I want it to open the 'helpPaul' div.

Some extra needs:

1. switching to a different tab should close the currently open help div (e.g. helpBen or helpPaul)

2. There should only be one help div (e.g. helpBen or helpPaul) open at any one time.

I partly solved this with the following code but with erratic results and I'd like to know what I'm dong so wrong!Here is the HTML for the help button:

<a class="helpTrigger" href="#">Help</a>

The help DIV's are like this:

<div class="helpBen">help relevant to Ben section</div>
<div class="helpPaul">help relevant to Paul section</div>

The CSS for .help is display: none; by default so none are shown from the outset.

And here is the jQuery
$(".helpTrigger").click(function(){
if (location.hash == '#Ben') {[code].....

In the words of Dr Evil, "throw me a frikkin' bone here..."

View 6 Replies View Related

JQuery :: Cycle Plugin: Anchor Links Fail Using Lite Version

Jun 22, 2011

I noticed that image anchors do not work when using the lite version of jQuery Cycle(jquery.cycle.lite.min.js) . I am referring to this example: [URL]

I copied all the code from the example and couldn't get it to work, out of desperation I switched to using jquery.cycle.all.js and the anchors instantly began working. It seems the lite version only drops the opacity on inactive slides, because clicking any slide uses the anchor href from slide 1.

EDIT: Just tested with the other versions of Cycle, and found all the other versions of cycle work flawlessly.. curious :

jquery.cycle.min.js *works*
jquery.cycle.all.js *works*
jquery.cycle.all.min.js *works*
jquery.cycle.lite.js *fails*
jquery.cycle.lite.min.js *fails*

[URL]

View 2 Replies View Related

JQuery :: Image - Using Append() With Anchor Links In WebKit (Chrome/Safari)?

Mar 22, 2011

Been trying to add an image before the closing of the anchor tag:

<body>
<a href="http://www.test.com/">http://www.test.com/</a>
</body>

If I use:

$("a").append("<img src='testimage.png' /");

No image will appear in WebKit (Chrome, Safari, etc). Firefox and IE works fine.

View 2 Replies View Related

JQuery :: Toggle Checkbox When Parent Element Is Clicked

Aug 6, 2010

I have an <input type="checkbox"> whose immediate parent is an <a> tag. The <a> is significantly larger than the <input>.

I want the checkbox to toggle on/offwhether the <a> is clicked or the checkbox itself. I also wantto store the value of the checkbox after it changes.

This sounds simple butI'm having trouble with the event bubbling (as in, I don't understand it).

Here is my current code.

HTML:

View 4 Replies View Related

JQuery :: Toggle Function - Check Clicked One And Activate Next Image

May 20, 2009

I just started with Jquery:
<script type="text/javascript">
$(document).ready(function() {
$('#desperation input[type=image]').attr('disabled', true).fadeTo
("fast", 0.10);
$('#1').attr('disabled', false).fadeTo("fast", 0.70);
});
$('#1').toggle(
function () {
$('#1').click(function() {
$('#1').fadeTo("fast", 1.00).attr('checked', true);
$('#2').attr('disabled', false);
});},
function () {
$('#1').click(function() {
$('#1').fadeTo("fast", 0.70).attr('checked', false);
$('#2').attr('disabled', true);
});});
</script>
<div id="skill">
<form action="javascript:void(null);" method="post"
enctype="application/x-www-form-urlencoded" id="skillplanner"
name="skillplanner" >
<fieldset id="desperation"><legend>Freetrader Skills: Desperation</
legend>
<input type="image" src="files/icons/underdog.png" id="1"></input>
<input type="image" src="files/icons/dump_guns.png" id="2"></input>
<input type="image" src="files/icons/desperation_fire.png" id="3"></input>
<input type="image" src="files/icons/rum_ration.png" id="4"></input>
<input type="image" src="files/icons/hasty_fire.png" id="5"></input>
</fieldset></form></div>
The problem is with the toggle function. On click it should "check" clicked one and activate next one. Function doesnt work and I dont have a clue....

View 1 Replies View Related

Adding A Html Anchor To An Onclick Toggle Event?

Sep 16, 2011

Complete newb trying to break apart existing code to add some additional function.

This is the working code:

<a class="hackadelic-sliderButton" title="click to collapse panel" onclick="toggleSliderOfGroup('.a-32', '#hackadelic-sliderPanel-1')" href="javascript:;">Close Panel </a>

What I would like to do is add in an html anchor so that the browser relocates to the top of the page just as the panel toggles closed. ie

<a href="#topofpage"></a>

View 4 Replies View Related

Get To Know Which Anchor Link Being Clicked Using Script?

Oct 2, 2009

Sorry I am new to JavaScript.

Says that a.html has two same anchor links (<a href="b.html">b</a>). The anchor links are uneditable but we could add JavaScript to the a.html.

Except for dynamic adding onclick event, any other ways could get to know which anchor link being clicked?

View 1 Replies View Related

JQuery :: Multiple Links - Find Which One Was Clicked

Sep 24, 2009

I have a table that looks something like this:

<tr id="1">
<td>Name</td>
<td>E-Mail</td>

[code]....

With multiple rows. Each row has a unique ID (numerical). I need to be able to click on an a.accept, find WHICH one was clicked (which row it is in), and get the ID of that row. I've been looking around and I found parent(), but I'm not sure how I can specifically get which accept link was clicked.

View 6 Replies View Related

Refresh Website After 1 Sec When Anchor Link Clicked

May 25, 2011

I need a script which will refresh the page 1 sec. After the anchor text is clicked
PHP Code:
<a href="#YourAnchor"></a>

View 1 Replies View Related

OnClick="function Value Of The Anchor Tag Just Clicked?

Oct 23, 2010

onClick="function(' whats the value of the anchor tag just clicked? Title basically says it. I need to get the object that was just clicked, to insert into a JavaScript function. I've tried "function('this')" and similar things, but it doesn't work. I'm sure this is REALLY easy to do, but I don't know it and I have no idea what to search for.

View 1 Replies View Related

Using Href:javascript And Anchor Links On Same Page

Jul 8, 2003

I'm working on a project where we're using JavaScript to let users swap styles on a page. To accomplish this, I'm calling the script via href="javascript:swapcss()" on the switch styles button.

Some pages on the site have anchor links. On those pages, if someone swaps styles without hitting any of the anchor links, all is well. But if someone hits an anchor link and then hits the swap button (at this point the URL is pageid.html#anchor), the page just reloads to their anhor point without swapping styles.

Does anyone have a workaround handy? I've tried several alternatives I've found online (href="#" onClick="action"; href="javascript void(0)" ). Nothing works for this case yet. Code:

View 3 Replies View Related

External Anchor Links Breaking Scrollpane?

Jan 19, 2011

If you click on the Retaining Walls link, it will direct you to a new page and the anchor will be highlighted. The issue is that if you attempt to click on Drainage or Design/Build, then it will not scroll up to the anchor.Other than that, if you were already on that page, then the anchors and scroll works fine. Is there something I can do to fix it?

View 5 Replies View Related

HTML - Displaying A Hidden Slider When <Anchor> Is Clicked

Nov 2, 2009

The <a> is a list of menu items that when clicked.... a specific gallery-slider-images should been shown in relation to the galleryId....<div class"gallery" is hidden in CSS> I'd like to use jQuery to complete this task if at all possible, i can't seem to .show() the selected 'gallery' w/o showing them all...........

View 1 Replies View Related

OnClick="function - Whats The Value Of The Anchor Tag Just Clicked

Oct 23, 2010

I need to get the object that was just clicked, to insert into a JavaScript function. I've tried "function('this')" and similar things, but it doesn't work.

View 3 Replies View Related

Navigate Anchor Links Using A Button Onclick Event?

Feb 18, 2010

I am wondering if it is possible to navigate anchor links using a button onclick event. I want next and previous hit buttons to navigate the already existing hits (#hit1, #hit2, etc.).For instance, I have:

<script type="text/javascript">
var numHits = {HITS}-1;
function nextHit(){[code]....

I have seen working examples with the href tag (e.g. <a href="#" onclick="func();return false">), but nothing with buttons. I also can't seem to get the working href examples to work on my server.For instance, I cannot get this code to work, it just goes to js_required.html:

<a href="js_required.html" onclick="doSomething(); return false;">go</a>
function doSomething(){
alert("test");
}

View 3 Replies View Related

Stop Jump To Anchor Links On Page Refresh?

Jun 22, 2010

I've used the ScrollTo plugin for header images for each topic and I have created a menu to change the content in the div(s) that contain readable content with ajax, so it looks like different pages with headers using the one page.

everything works well, but on browser refresh the page jumps down after the menu and on to the header.

Would anyone know a script that would deactivate all anchor links in the page so that page onload the page loads as default index.html instead of index.html#some_anchor

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved