JQuery :: Multiple Divs Using Same Class?

Apr 28, 2011

I have a div with a height of 100 pixels.If the content is too much to fit in div, I want to show a 'Read More' link at the bottom.If you then click 'Read More', the div expands to full height so all the content can be seen and the link text changes to 'Read Less'.If you then click 'Read Less', the div contracts back to 100 pixels.I've found solutions that can handle the above situation, but I want to have multiple divs with the same class that all work independantly of each other.So I'd have the following HTML

[code]
<div class="openclose">
...some content...

[code]....

View 3 Replies


ADVERTISEMENT

Onclick Description Div For Class Of Multiple Divs?

Jan 22, 2010

The very basic onclick code I threw together:

function descw()
{
document.getElementById("desc").style.display="block";
}
function descc()

[Code]...

This works, but I have a whole class of divs named select that need their own individual description divs. Id method is okay for one div apparently, but if I click on others it loads the first description div. What do I use instead? I tried getElementsByName and Atrribute and got an error.

View 16 Replies View Related

JQuery :: Hover And Multiple Divs - All Hidden Divs Are Shown, Not Just The One That Supposed To?

Oct 14, 2010

I have been trying to do some tooltips for a website and desperately wanted to learn something new and do that with jQuery.However, every time a mouse hovers over a tooltip, all hidden divs are shown, not just the one that supposed to. Here's my html:

Code HTML4Strict:
<div class="tip">
<a href="#"></a>[code].....

View 2 Replies View Related

JQuery :: Turn On An 'inactive-state' CSS Class For A Group Of Divs, Then Reset One Div To The 'active-state' Class?

Feb 2, 2011

I am attempting to make a menu that has a background image that changeswhen you rollover or click a menuitem. I've got the hover effect working fine with CSS, but am trying to implement the click event via jquery with the following:

CSS:
div.SustainResourcesMenuTabs
{ background-image: url('/images/departments/commdev/sustainability/menu_tab.jpg');
}[code]....

My process is to reset the entire menu to the inactive state, then switch on the active state for the item that was clicked. Eventually, the item that was clicked will display its corresponding body section as well. I've tried using the CSS pseudo-class "active", but since the entire div is the link, that is unavailable. I've also tried multiple variations of addClass/removeClass, toggleClass, and setAttribute/removeAttributebut nothing hasworked so far.

View 2 Replies View Related

JQuery :: Adding Class To All Divs Not Containing An Element

Jul 26, 2010

I need to add a class to every div (with ID #myDiv) NOT containing an <li>-Tag.

I have:

Line 5 doesn't add the class to the div.

View 6 Replies View Related

JQuery :: Swap The Content Within A Div Without Affecting The Other Divs With The Same Class?

May 28, 2010

I have a listing of items on the page and each one has a <div> with a description in it. There are two versions of each description, one short and one full length. I like the user to be able to swap between them by clicking the 'more' and 'close' links. The problem with what I wrote is that it applies to all the divs on the page instead of the specific one that was clicked. What can I change to correct it?

The jQuery:

$(document).ready(function() {
$('div.desc > p.desc-full').hide();
$('a.more').click(function() {
$('div.desc > p.desc-trunc').slideUp('fast');

[Code].....

View 1 Replies View Related

JQuery :: .hover Displays / Removes All DIVs With That Class

Dec 19, 2010

URL..when you hover over an image, I've used .hover to fadeIn a DIV called 'zoomicon' for that image, but my problem is that when you hover one image, not only does the zoomicon for that image fade in, but all instances of zoomicon fade in, as well as fade out.how do Iseparateinstances of zoomicon to fade in and fade out for their respective image blocks?[code]

View 3 Replies View Related

JQuery :: Loop Through All Divs Where Class = AppStatus And On Each Iteration Pull Data From A PHP Page?

Dec 1, 2010

I have a bunch of dynamically created divs which I need to loop through and then display text inside which is obtained via AJAX.

<div class="appStatus" id="appStat_1>TEXT FROM PHP PAGE</div>
<div class="appStatus" id="appStat_2>TEXT FROM PHP PAGE</div>
<div class="appStatus" id="appStat_3>TEXT FROM PHP PAGE</div>

Basically, I want to loop through all divs where class = appStatus and on each iteration pull data from a PHP page (via AJAX) to display in the DIV. I need to send the value after the _ of the id (which I can obtain using substring) with the AJAX request in order to return the correct text.For some reason.I know that I need to do something with

$("div.appStatus").each(function() {
)};

Just got myself lost in everything I tried.

View 2 Replies View Related

JQuery :: Multiple Divs With Same Effect?

Jan 26, 2011

On my site I have a news page, where users can read part of the news (trimmed with php) and then they click "Read more" to see the full news item. That item then comes up in a popup (using jQuery of course) and should be displayed. To get this to work I'm usingthisby including it like so:

<script type="text/javascript" src="includes/jquery.colorbox.js"></script>

The jQuery code looks like so:

$('.open').colorbox({width:"50%", inline:true, href:"#news"});

This all works great with that one div. The problem is, my news will be coming from a MySQL-query via PHP in a while-loop and I need this effect applied to every single news item. What I tried is to do this:

while($row = mysql_fetch_assoc($rs)) {
echo '<a class="open" href="#">Read more</a>';
echo '<div id="wrapper" style="display:none">';

[code]....

how do I make this work? How do I make jQuery open only the news item I'm clicking on? I know it could possibly be done with (this) and maybe children() or something like that? But I'm totaly lost at the momeny, I've tried loads of stuff with the pieces mentioned above but can't get it to work and most times I just "break" the jQuery and the popup won't even come up at all.

View 4 Replies View Related

JQuery :: Multiple SlideToggle Divs?

Aug 20, 2010

I'm trying to piece together a little div which slides out and shows various links to sites like Digg, Reddit to share the story with. I've got it kind of working but when there are multiple divs on the page, named the same like in each article of a post on a Wordpress blog. Only the top ones work and the rest don't do anything...I'm trying to get it do something like the image => HereThis is an example I'm trying to get to work but the second "slickbox" div never shows

View 1 Replies View Related

JQuery :: NextUntil Over Multiple DIVS?

Jan 31, 2011

I'm trying to use nextUntil to select all the .cell divs between the .start-date and .end-date, the code works for the .cell's within it's .cal-container but if wont work over multiple .cal-containers.The code I have is$('.start-date').nextUntil('.end-date').addClass('fill-date');

<div class="cal-container">
<div class="cell" id="1" title="01-01-2011">1</div>
<div class="cell" id="2" title="02-01-2011">2</div>

[code]....

View 2 Replies View Related

JQuery :: Animate Multiple Divs On Click?

Mar 7, 2011

I want to animate divs on click . But the problem is there are multiple divs and I unable to get the height of each div

my code isfunction show (div) {
var hei = $('.a').height();
$('.show').click(function(){
$('.text').animate({'height' : hei + 'px'})

[Code]...

View 7 Replies View Related

JQuery :: Displaying/Hiding Multiple DIVs?

Jan 29, 2011

Getting myself back into jQuery and have an issue which I didn't previously fix, and was wondering if anyone would be able to assist me. I have multiple DIVs (up to 50 on one page) that I wish to individually be able to hide and close an extra DIV once pressing the 'Details' to show, and 'Hide' to hide the extra hidden DIV.

[Code]...

View 2 Replies View Related

JQuery :: Get Height Of A Div Inside Multiple Divs?

Nov 14, 2011

I am trying to get the height of a div that is inside 7 other divs. I noticed the height() method works with the first and second div, but it does not work after that.

Example :
<div id="first">
<--------------------------- $("first").height(); works ![code]....

how to get the height of a div that is inside multiple other divs ?

View 1 Replies View Related

JQuery :: Hiding/showing Multiple DIVs?

Jun 20, 2010

I'm new to jQuery, and I'm having issues with showing my DIVs correctly. The problem with the script at the moment, is that it currently opens up every single .display div, whereas I only want it to open up the one which corresponds to the.input a.edit which I've clicked.

The script hides them individually, displays the hide button and makes the show button display correctly like I wish, but it's displaying all the the .display div's at the same time which isn't what I want. For reference here is my jQuery script:

[Code]...

View 7 Replies View Related

JQuery :: Fade In Multiple Divs On A Page?

Sep 23, 2011

I need to be able to fade in 3 divs but not all at the same time, I need one to fade when thats finished, fade in then the next, then the next. Can anyone help me with this? I assume its got something to do with queue's but im not 100%

View 1 Replies View Related

JQuery :: Display DIVs As Multiple Columns?

Aug 23, 2009

How can I display a bunch of DIVs in multiple columns? Like Flex's TileList component.

A
B
C
C

[code]....

View 2 Replies View Related

JQuery :: How To SlideUp / SlideDown Multiple DIVs

Jul 15, 2009

$("#addURLSArea").hide();
$('.jqTransformCheckbox').click(function(){
if ($('#multCheck:checked').val() == 'on') {
$("#addURLSArea").slideDown();
} else {
$("#addURLSArea").slideUp();
}});
I want to use this 4 times on a form. How do I change this so I can have it target 4 different divs?

View 2 Replies View Related

JQuery :: Multiple Animations With A Delay On A Set Of Divs?

May 16, 2010

I have a group of 4 divs and I'm looking to use jQuery to animate them once, then have a delay using delay(), and then run another set of animations on them, putting the divs back to their original configuration. Here's the code that I have:

//only selectors called 'option1' are affected by delay, and not 'option1 img' or 'option2'
$("#option1").showOption1().delay(3000).hideOption1();
//if i don't attach to #option1, delay doesn't work, but the animations that need to happen simultaneously work

[Code]....

will work from hideOption1() after the delay. The rest of hideOption1() is fired immediately after showOption1() finishes, ignoring the delay.

On the other hand, if I run line 5, all the code in hideOption1() runs simultaneously as desired, but ignores the delay entirely, running immediately after showOption1() finishes. How can I have all the code in hideOption1() run simultaneously after the delay?

View 2 Replies View Related

JQuery :: Multiple Divs Toggle With Click

Dec 18, 2011

I am trying to toggle multiple divs toggle open/closed show/hide with a slide left effect It works but is buggy if you click too fast [URL] I want to create this but control to content in the sliding divs [URL]

View 1 Replies View Related

JQuery :: Opening And Closing Multiple Divs

Jan 4, 2012

I have five divs that I want to work kind of like an accordion, but you can open multiple sections. Right now, when user clicks any link, it opens all five sections. And when you click to close, it closes all five. I want to be able to open one section, then go to the next and so on.

Here's what I have now:

Html looks like this:

View 1 Replies View Related

JQuery :: Positioning Multiple Divs Using A For Loop?

Dec 9, 2010

I am trying to arrange 15 divs into a 5x3 grid.The divs have an id of piece1, piece2, piece3 etcI figured I could run a loop wherein each div is positioned to the right of the last.For each div, I'm trying to store the current position and width into variables then move it to the right by the number of pixels the div measures widthwise.This would position 5 divs horizontally and I am still unsure of how to get the next row of 5 divs positioned under the first and so on.This is what I have so far:

JQuery
for (var i=0; i<x; i++) {
var pos = $("#piece" + i).offset();

[code]....

View 1 Replies View Related

JQuery :: Using .load() Function For Multiple Divs?

Aug 29, 2010

I'm trying to use the function once which is .load() and fetch my content from there,then after that I'd like to seperate the class's or div's I'll be using such as <div d="test1">This content will show in the external website</div>But I'm having trouble doing that, I've used multiple lines just to load the same page and take small bits of content out and it doesn't work well together as some load's results will be different compared to the others.Heres my code:

$('#". $Server['ServiceName'] ."').fadeOut('slow', function(){ $('#". $Server['ServiceName'] ."').load('./includes/serversinfo.php #servers #". $Server['ServiceName'] ."', function(){ $('#". $Server['ServiceName'] ."').fadeIn('slow'); }); });

[code]....

View 2 Replies View Related

JQuery :: UI Tabs Updating Multiple DIVS?

Jan 12, 2009

I'm trying to get the following code to update two divs at a time rather than one

$(document).ready(function() {
$jQuery("ul").tabs();
}[code].....

View 4 Replies View Related

Using A JS Function On All Divs Of A Certain Class?

Jun 16, 2003

When the page loads I want it to go through a certain function for every div of a certain class.

View 7 Replies View Related

JQuery :: Correctly Applying Same Function To Multiple DIVs

Oct 5, 2010

I'm trying to get something to work that sounds simple and it worked great until I had a second item to apply it to. This works fine, with one div. When you hover over the link with the class 1slide, it loads the div with the class panel1. The problem is I can't get it to work if I use a second function for .2slide to load the div .panel2.
<script type="text/javascript">
jQuery().ready(function(){
jQuery(".1slide").hover(function(){
jQuery(".panel1").slideToggle("slow");
});});
</script>

I've tried multiple variations, including 2 <script> tags with the classes swapped, and combining as shown below
<script type="text/javascript">
jQuery().ready(function(){
jQuery(".1slide").hover(function(){
jQuery(".panel1").slideToggle("slow");
});
jQuery(".2slide").hover(function(){
jQuery(".panel2").slideToggle("slow");
});
});
</script>

I think I'm combining these wrong but I've tried multiple different ways. They're classes now but were ID's, and that didn't work either. Figures, I was hesitant about posting hours ago because I knew it might be something simple.. I almost solved everything with this:
<script type="text/javascript">
jQuery().ready(function(){
jQuery(".1slide").hover(function(){
jQuery(".panel1").slideToggle("slow");
jQuery(".2slide").hover(function(){
jQuery(".panel2").slideToggle("slow");
jQuery(".3slide").hover(function(){
jQuery(".panel3").slideToggle("slow");
})})})})
</script>

All 4 div's .panel1, .panel2, .panel3 are set to display:none. The only issue now is panel3 is twitchy. I have a feeling it's yet again just a closing bracket issue. Am I writing this correctly? semi-colons anywhere, mess the entire thing up. I am using FireFox 3.5 for reference.

View 2 Replies View Related







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