Search Results

Search found 8467 results on 339 pages for 'alternate elements'.

Page 43/339 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • Relocating html elements with jquery

    - by Steven
    Could someone help me with this code? I'm trying to rearrange figures in a certain div into two columns (a and b) in such a way the two columns are about the same height. I've got insane trying to find the problem in my code and not finding it. It doesn't work for a reason... <body onload="rearrangeImages();"> <div class="images"> <figure> <figcaption>This is the figcaption of this figure. An image is missing for this test.</figcaption> </figure> <figure> <figcaption>This is the figcaption of this figure.</figcaption> </figure> <figure> <figcaption>Another one.</figcaption> </figure> </div> <script> function rearrangeImages() { $('.images').each(function() { $(this).prepend('<div class="column_b"></div>'); $(this).prepend('<div class="column_a"></div>'); $(this).append('<div class="test_div"></div>'); $('figure', this).each(function() { var height_a = $(this).parent().$(".column_a").height(); var height_b = $(this).parent().$(".column_b").height(); if (height_a > height_b) { $(this).parent().$(".column_b").append(this); } else { $(this).parent().$(".column_a").append(this); } $(this).remove(); }); }); } </script> </body> Next I would like to be able to make the last figure not going in any of the columns in case it would make column_b higher than column_a. (pseudocode) if (this is last figure) { //place last figure in test_div to measure its height; if (height_a > height_b + height_of_last_image) { $(this).parent().$(".column_b").append(this); } else { $(this).parent().append(this); } } else { //do the normal stuff see higher }

    Read the article

  • JQuery: Remove duplicate elements?

    - by Keith Donegan
    Say I have a list of links with duplicate values as below: <a href="#">Book</a> <a href="#">Magazine</a> <a href="#">Book</a> <a href="#">Book</a> <a href="#">DVD</a> <a href="#">DVD</a> <a href="#">DVD</a> <a href="#">Book</a> How would I, using JQuery, remove the dups and be left with the following for example: <a href="#">Book</a> <a href="#">Magazine</a> <a href="#">DVD</a> Basically I am looking for a way to remove any duplicate values found and show 1 of each link.

    Read the article

  • contain new elements of an "instance" in javascript

    - by iamnotmad
    Hi, so I know there are tons of ways to simulate inheritance and other OO features. I have chosen one to use for my project and am wondering if I can create an instance and add stuff to it and keep it contained (within braces). Consider the following: function BaseClass(){ <this.stuff here> } function SubClass(){ this.superClass = BaseClass(); this.superClass(); <this.other stuff here> } myObj = new SubClass(); so myObj is an instance of SubClass. I can add things to myObj like: myObj.blah = "funtimes"; What I would like is to be able to add stuff to the "instance" and keep it organized in braces much like the constructor. psuedo code like: myObj = new SubClass() { var blah = "funtimes" <more instance specific stuff here> } Is something like this possible? Thanks!

    Read the article

  • Hide elements for current visit only

    - by deanloh
    I need to display a banner that sticks to the bottom of the browser. So I used these codes: $(document).ready(function(){ $('#footie').css('display','block'); $('#footie').hide().slideDown('slow'); $('#footie_close').click(function(){ $('#footie_close').hide(); $('#footie').slideUp('slow'); }); }); And here's the HTML: <div id="footie"> {banner here} <a id="footie_close">Close</a> </div> I added the close link there to let user have the option to close the banner. How ever, when user navigates to next page, the banner shows up again. What can I do to set the banner to remained hidden just for this visit? In other words, as long as the browser remained open, the banner will not show up again. But if user returns to the same website another time, the banner should load again. Thanks in advance for any help!

    Read the article

  • adding elements in to the doubly linked list

    - by user329820
    Hi this is my code for main class and doubly linked class and node class but when I run the program ,in the concole will show this"datastructureproject.DoublyLinkedList@19ee1ac" instead of the random numbers .please help me thanks! main class: public class Main { public static int getRandomNumber(double min, double max) { Random random = new Random(); return (int) (random.nextDouble() * (max - min) + min); } public static void main(String[] args) { int j; int i = 0; i = getRandomNumber(10, 10000); DoublyLinkedList listOne = new DoublyLinkedList(); for (j = 0; j <= i / 2; j++) { listOne.add(getRandomNumber(10, 10000)); } System.out.println(listOne); } } doubly linked list class: public class DoublyLinkedList { private Node head ; private Node tail; private long size = 0; public DoublyLinkedList() { head= new Node(0, null, null); tail = new Node(0, head, null); } public void add(int i){ head.setValue(i); Node newNode = new Node(); head.setNext(newNode); newNode.setPrev(head); newNode = head; } } and the node class is like the class that you have seen before (Node prev,Node next,int value)

    Read the article

  • How is Magento using the module_name tag elements in the module config file

    - by zokibtmkd
    I found here that Magento is using these tags as custom config variables, but I still cannot understand where are they used and how. For example the Wishlist module has wishlist (same name as the module) xml tag in the config.xml file in which it defines: <item> <product_attributes> <visibility/> <url_path/> <url_key/> </product_attributes> </item> Where is this module using these configurations? Also if I was to build payment method, I have to add in my custom module config.xml a tag for sales and then for quote and so on... I also found other related questions, but most of the answers were that these tags can be anything, but I need to know how they are used by the system. Thank you in advance

    Read the article

  • Using Selenium 2's IWebDriver to interact with elements on the page

    - by Andreas Grech
    I'm using Selenium's IWebDriver to write Unit Tests in C#. Such is an example: IWebDriver defaultDriver = new InternetExplorerDriver(); var ddl = driver.FindElements(By.TagName("select")); The last line retrieves the select HTML element wrapped in a IWebElement. I need a way to simulate selection to a specific option in that select list but I can't figure out how to do it. Upon some research, I found examples where people are using the ISelenium DefaultSelenium class to accomplish the following, but I am not making use of this class because I'm doing everything with IWebDriver and INavigation (from defaultDriver.Navigate()). I also noticed that ISelenium DefaultSelenium contains a ton of other methods that aren't available in the concrete implementations of IWebDriver. So is there any way I can use IWebDriver and INavigation in conjunction with ISelenium DefaultSelenium ?

    Read the article

  • Jquery: Incrimentation for each set of elements in more than 1 div

    - by Jack
    I'm making a Jquery slideshow. It lists thumbnails, that when clicked on, reveal the large image as an overlay. To match up the thumbs with the large images I'm adding attributes to each thumbnail and large image. The attributes contain a number which matches each thumb to its corresponding large image. It works when one slideshow is present on a page. But I want it to work if more than one slideshow is present. Here's the code for adding attributes to thumbs and large images: thumbNo = 0; largeNo = 0; $(this + '.slideshow_content .thumbs img').each(function() { thumbNo++; $(this).attr('thumbimage', thumbNo); $(this).attr("title", "Enter image gallery"); }); $(this + '.slideshow_content .image_container .holder img').each(function() { largeNo++; $(this).addClass('largeImage' + largeNo); }); This works. To make the incrementation work when there are two slideshows on a page, I thought I could stick this code in an each function... $('.slideshow').each(function() { thumbNo = 0; largeNo = 0; $(this + '.slideshow_content .thumbs img').each(function() { thumbNo++; $(this).attr('thumbimage', thumbNo); $(this).attr("title", "Enter image gallery"); }); $(this + '.slideshow_content .image_container .holder img').each(function() { largeNo++; $(this).addClass('largeImage' + largeNo); }); }); The problem with this is that the incrimenting operator does not reset for the second slideshow div (.slideshow), so I end up with thumbs in the first .slideshow div being numbered 1,2,3 etc.. and thumbs in the second .slideshow div being numbered 4,5,6 etc. How do I make the numbers in the second .slideshow div reset and start from 1 again? This is really hard to explain concisely. I hope someone gets the gist.

    Read the article

  • Custom layout in Android: scrollable graphic with selectable elements over top

    - by Martyn
    Hi, I'm fairly new to the Android platform and was wondering if I could get some advice for my current head scratcher: I'm making an app which in one view will need an image, which can be scrolled on one axis, with a load of selectable points over the top of it. Each point needs to be positionable on the x and y (unlikely to change once the app is running, but I'll need to fine tune the positions whilst I'm developing it). I'd like to be able to let the user select each point and have a graphic drawn on the point the user has selected or just draw a graphic on one/more points without user intervention. I though for the selectable points I could extend the checkbox with a custom image for the selected state - does that sounds right, or is there a better way of doing this? Is there any thing I can read up on doing this, I can't seem to find anything on the net about replacing the default images? I was going to use the absolute layout, but see that it's been depreciated and I can't find anything to replace it. Can anyone give me some code or advice on where to read up on what I need to do? Thank you in advance

    Read the article

  • getting hidden elements

    - by Emin
    Say I have the following unordered list <ul class="container"> <li class="item" style="display: none;">first item</li> <li class="item">second item</li> <li class="item">third item</li> <li class="item">forth item</li> </ul> how can I carry out a task only if all the items in the container are hidden? regards...

    Read the article

  • Radio buttons + array elements

    - by Mark
    I have a form that can be dynamically duplicated (with JS) so that the user can enter as much data as he wants. This works great for text inputs, because I just leave the name attribute the same (ending with a []) and then when the values are posted, it just returns me an array. Now I just realized that this doesn't work so well for radio buttons, because the names actually need to be unique for each set. But from the data standpoint, each set only returns one value, so retrieving the data from the POST data wouldn't be a problem, it just screws up the functionality of my form. There's no way around this, is there? I'm just screwed and I can't use arrays?

    Read the article

  • Comparing two select elements values

    - by user1135192
    I've been been trying to look for a piece of javascript code that compares the values selected by a user in a html form from two <select> tags. So if the user selects a minimum value that is greater than the maximum number an alert box in javascript should be displayed. For example, if the user selects 5 bedrooms from the the MINIMUM bedrooms dropdown list and then 3 bedrooms from the MAXIMUM bedrooms dropdown list, this should not allow the form to be processed when the submit button is clicked. But is fine when 3 is selected from the MINIMUM dropdown list and 5 from the MAXIMUM dropdown list. <form name="search" action="page3.php" method="GET"> <select name="minimumBeds"> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> </select> <select name="maximumBeds"> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> </select> </form>

    Read the article

  • CodeIgniter - the right way to create "block" elements on web page

    - by kikkoman90
    Hello. I've been searching for a solutions for this problem a while but haven't seen any "valid mvc" solution for this. I hope I can explain my problem clearly enough for you guys. I need to create a dynamic block of HTML on my website. (eg. a block containing user's latest blog comments). I have a template view file (a file containing header, content container and a footer) where I need to add some content AND this block element. The problem is that I don't want to duplicate this block code on every controller. It just feels stupid and I'm sure there's a better way to do this than just duplicating same stuff all over again on all the controller files? I can add view inside another view just fine, but what bugs me is how to actually generate that dynamic content to this block's view-file. I can't call controller from view file, controller from controller filem or model from view file because what I understand that just isn't the "mvc" way? Anyone got any tricks or tips for this?

    Read the article

  • How to use Groovy Set for unique elements?

    - by Guy
    As simple as this must be I still can't understand where am I wrong: class A { boolean equals(o) { true } } def s = [new A(), new A()] as Set assert s.size() == 1 // Assertion failed: actually gives 2 Which method should I override in order to get uniqueness?

    Read the article

  • replacing elements horizontally and vertically in a 2D array

    - by wello horld
    the code below ask for the user's input for the 2D array size and prints out something like this: (say an 18x6 grid) .................. .................. .................. .................. .................. .................. code starts here: #include <stdio.h> #define MAX 10 int main() { char grid[MAX][MAX]; int i,j,row,col; printf("Please enter your grid size: "); scanf("%d %d", &row, &col); for (i = 0; i < row; i++) { for (j = 0; j < col; j++) { grid[i][j] = '.'; printf("%c ", grid[i][j]); } printf("\n"); } return 0; } I now ask the user for a string, then ask them where to put it for example: Please enter grid size: 18 6 Please enter word: Hello Please enter location: 0 0 Output: Hello............. .................. .................. .................. .................. .................. Please enter location: 3 4 Output: .................. .................. .................. ..Hello........... .................. .................. program just keeps going. Any thoughts on how to modify the code for this? PS: Vertical seems way hard, but I want to start on horizontal first to have something to work on.

    Read the article

  • JAX-B annotations for elements that inherit from a parent

    - by AlexM
    When adding JAX-B Java annotations for Java classes - if I have a parent Class Entry, with two children, Book and JournalArticle, Would I add these annotations for all three classes: @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement ie: @XmlSeeAlso({au.com.library.Book.class, au.com.library.JournalArticle.class}) @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public abstract class Entry implements Serializable{ private static final long serialVersionUID = -1895155325179947581L; @XmlElement(name="title") protected String title; @XmlElement(name="author") protected String author; @XmlElement(name="year") protected int year; and @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public class Book extends Entry { @XmlElement(name="edition") private String edition; @XmlElement(name="publisher") private String publisher; @XmlElement(name="placeOfPublication") private String placeOfPub; and @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public class JournalArticle extends Entry { @XmlElement(name="journalTitle") private String journalTitle; @XmlElement(name="volume") private String volume; @XmlElement(name="issue") private String issue; @XmlElement(name="pageNumbers") private String pgNumbers;

    Read the article

  • Accessing and manipulating lwpf listbox datatemplate elements

    - by black sensei
    Hello good people , i'm trying to achieve a functionality but i'm don't know how to start it. I'm using vs 2008 sp1 and i'm consuming a webservice which returns a collection (is contactInfo[]) that i bind to a ListBox with little datatemplate on it. <ListBox Margin="-146,-124,-143,-118.808" Name="contactListBox" MaxHeight="240" MaxWidth="300" MinHeight="240" MinWidth="300"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock> <CheckBox Name="contactsCheck" Uid="{Binding fullName}" Checked="contacts_Checked" /><Label Content="{Binding fullName}" FontSize="15" FontWeight="Bold"/> <LineBreak/> <Label Content="{Binding mobile}" FontSize="10" FontStyle="Italic" Foreground="DimGray" /> <Label Content="{Binding email}" FontStyle="Italic" FontSize="10" Foreground="DimGray"/> </TextBlock> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Every works fine so far. so When a checkbox is checked i'll like to access the information of the labels (either the) belonging to the same row or attached to it and append the information to a global variable for example (for each checkbox checked). My problem right now is that i don't know how to do that. Can any one shed some light on how to do that? if you notice Checked="contacts_Checked" that's where i planned to perform the operations. thanks for reading and helping out

    Read the article

  • Elements of a Java Object Array are created but without correct names

    - by Greenhouse Gases
    Hi all Im having rather an annoying problem. I have a class called Person and a class called Event which serve to create objects to be used for competitors that compete in a certain event. When I add a competitor thats fine and the GUI list updates accordingly, however when I add an event the element in the array does not take on the value of the instance variable name in the class Event and so the GUI does not show the event name, though it is being added in the array correctly. How can I make it so that the event object in each element of the listOfEvents array (which is an array of event objects) has the name of the event. I should add this is for university though this isnt the part for which we will be assessed, it is somethign i have come across and due to not being able to see the code for the GUI, I've hit the proverbial brick wall. I wont include the whole load of code Ive been writing but hopefully my description and snippets below will suffice. Any advice I would appreciate greatly. No doubt I have overlooked something simple! Many thanks. listOfEvents is declared as: Event[] listOfEvents = new Event[20]; A snippet from the Event class: public class Event { String name; Person[] participants = new Person[10]; // array of competitors for the event public Event(String name) { this.name = name; } } and its use in the addEvent method (p is a global variable): public void addEvent(String eventName) { listOfEvents[p] = new Event(eventName); p++; }

    Read the article

  • Hiding and Showing Elements with JavaScript

    - by user1658756
    I have an arrow on my site that I'd like if onclick, it hides one element, and shows another. Hitting it again, will hide the element that was shown and show the element that was hidden. Is that possible to do without jQuery? For example, I have <div id="arrow"><a href="#">?</a></div> <div id="ad"></div> <div id="description">Hidden</div> <div id="nav">Also Hidden</div> So at first, the ad is showing, and then one you've clicked the arrow, I'd like the ad to hide, and then unhide the description and nav.

    Read the article

  • DOS Batch file - Copy file based on filename elements

    - by user1848356
    I need to sort alot of files based on their filename. I would like to use a batch file to do it. I do know what I want but I am not sure of the correct syntax. Example of filenames I work with: (They are all in the same directory originally) 2012_W34_Sales_Store001.pdf 2012_W34_Sales_Store002.pdf 2012_W34_Sales_Store003.pdf 2012_November_Sales_Store001.pdf 2012_November_Sales_Store002.pdf 2012_November_Sales_Store003.pdf I would like to extract the information that are located between the "_" signs and put them into a different variable each time. The lenght of the informations contained between the _ signs will be different everytime. Example: var1="2012" var2="W34" (or November) var3="Sales" var4="001" If I am able to do this, I could then copy the files to the appropriate directory using move %var1%_%var2%_%var3%_%var4%.pdf z:\%var3%\%var4%\%var1%\%var2% It would need to loop because I have Store001 to Store050. Also, there are not only Sales report, many others are available. I hope I am clear. Please help me realize this batchfile!

    Read the article

  • getting the names of elements in JS/jQuery

    - by Mala
    I have some checkbox inputs like so: <input type="checkbox" name="1" class="filter"/> <input type="checkbox" name="2" class="filter"/> ...etc... I'm trying to write a function where any time a checkbox is selected, it generates a string with all the names concatenated. Here's what I have so far: $('.filter').click(function(event){ var filters = $('.filter').toArray(); var fstr = ""; for (f in filters) { fstr = fstr+","+f.name; } alert(fstr); }); The names keep coming up as 'undefined', though (i.e. the alert returns ,undefined,undefined,undefined,undefined,undefined,undefined). How do I access the names?

    Read the article

  • Can't access form elements

    - by linkcool
    Hi, my problem is that my variables are not working in javascript. all variables need names without some character at the beginning, this is the stupid thing...Anyways, im trying to make a funtion that makes "select all checkboxes". It is not working so i looked at the page source/info and found out that the variables were not changing. this is my input: echo "<input onclick='checkAll(1);' type='checkbox' name='master'/><br/>"; My function: function checkAll(i) { for(var i=1; i < <?php echo $num; ?>; i++) { if(document.demo.master[i].checked == true) { document.demo.message[i].checked = true; } else { document.demo.message[i].checked = false; } } } so yes that's it. I can tell you that i also tried without the <i> in: checkAll("i") Thanks for the help. EDIT: each checkbox for each messsage has this code:echo "<input style='margin-left:-15px;margin-top:20px;' type='checkbox' name='message' value='$rid' /><br/>";

    Read the article

  • jQuery - Cycling through child elements

    - by Dan
    Hi, I have a series of select boxes within a table like so: <tr> <td><select></select></td> <td><select></select></td> <td><select></select></td> <td><select></select></td> </tr> With about 10 rows. I'm trying to reset all of the select boxes in the row to a default value, but having trouble with the syntax, can anyone help? This is what I have at the moment, but it dosen't seem to be working: $(row).children('td > select').each().val('0'); Any advice appreciated. Thanks.

    Read the article

  • C++ : Swapping template class elements of different types?

    - by metamemetics
    template< class T1, class T2 > class Pair { T1 first; T2 second; }; I'm being asked to write a swap() method so that the first element becomes the second and the second the first. I have: Pair<T2,T1> swap() { return Pair<T2,T1>(second, first); } But this returns a new object rather than swapping, where I think it needs to be a void method that changes its own data members. Is this possible to do since T1 and T2 are potentially different class types? In other words I can't simply set temp=first, first=second, second=temp because it would try to convert them to different types. I'm not sure why you would potentially want to have a template object that changes order of its types as it seems that would cause confusion but that appears to be what I'm being asked to do.

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >