Search Results

Search found 3000 results on 120 pages for 'pseudo selector'.

Page 1/120 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • a selector which has this selector together with a class selector

    - by Woho87
    Here is an analogy of my problem(a selector which has this selector together with a class selector): Let say that I selects all yellow(classes) div elements in a arbitrary HTML document. And I want each to check if the attribute is yes = 1. If the attribute 'yes' equals '1', then I want the child with class 'blue' have the attribute 'no' equals '1'; $('div .yellow').each(function(){ if($(this).attr('yes') == 1){ $(this '.blue:first-child').attr('no', 1);//This line needs to be fixed } }); I know that the line this.getElementsByClassName('blue')[0] fixes this problem. But in my real problem (not this analogy) I want to use addClass and removeClass which only functions with jQuery objects. It is to cumbersome to use other functions than addClass and removeClass. UPDATE: Here is a code snippet from my real problem. I got some problem with "this" in javascript. I want a invited button to have the className visible when I click on it. The button lies within a div element with className 'box'. I know that there are problem with 'this' on the code snippet. But I want the button and not the box to change to visible $('.Box').each(function(){ if($(this).attr('hasButton') != 1){ var invite = document.createElement('div'); invite.className = 'invite invisible'; invite.innerHTML = 'invite'; $(this).attr('hasButton', 1); this.appendChild(invite); invite.addEventListener('mouseover', function(event){ $('.invite', this).removeClass('invisible');//this line is not functioning $('.invite', this).addClass('visible');//neither this }, false); } });

    Read the article

  • how can i select first second or third element with given class name using CSS?

    - by Tumharyyaaden
    ie. i have the following: <div class="myclass">my text1</div> some other code+containers... <div class="myclass">my text2</div> some other code+containers... <div class="myclass">my text3</div> some other code+containers... i have the css class div.myclass {doing things} that applies to all obviously but i also wanted to be able to select the first, second or third like this: div.myclass:first {color:#000;} div.myclass:second {color:#FFF;} div.myclass:third {color:#006;} almost like the jQuery index selection .eq( index ) which is what i am using currently but need a noscript alternative. Thanks in advance!

    Read the article

  • ListView item background via custom selector

    - by Gil
    Is it possible to apply a custom background to each Listview item via the list selector? The default selector specifies @android:color/transparent for the state_focused="false" case, but changing this to some custom drawable doesn't affect items that aren't selected. Romain Guy seems to suggest in this answer that this is possible. I'm currently achieving the same affect by using a custom background on each view and hiding it when the item is selected/focused/whatever so the selector is shown, but it'd be more elegant to have this all defined in one place. For reference, this is the selector I'm using to try and get this working: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="false" android:drawable="@drawable/list_item_gradient" /> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_disabled" /> <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_background_disabled" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focus" /> </selector> And this is how I'm setting the selector: <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:listSelector="@drawable/list_selector_background" /> Thanks in advance for any help!

    Read the article

  • Pseudo LRU tree algorithm.

    - by patros
    A lot of descriptions of Pseudo LRU algorithms involve using a binary search tree, and setting flags to "point away" from the node you're searching for every time you access the tree. This leads to a reasonable approximation of LRU. However, it seems from the descriptions that all of the nodes deemed LRU would be leaf nodes. Is there a pseudo-LRU algorithm that deals with a static tree that will still perform reasonably well, while determining that non-leaf nodes are suitable LRU candidates?

    Read the article

  • Help with a pseudo-class, first-child

    - by zac
    I am working on a CMS platform with limited access to the template files and want to try and control some of the layout with pseudo class but no luck yet. Can anyone see what is wrong with this structure and why my pseudo class is being ignored? <div id="main"> <div class="someRandomDiv"></div> <div class="block"> stuff </div> <div class="block"> more stuff </div> </div> and i am trying something like this #main .block {border: 1px solid blue} #main .block:first-child {border: 1px solid red} so with this example I would think the stuff block would have a red border and more stuff would have a blue but it is all just blue. Thanks for any help with this.

    Read the article

  • CSS :after pseudo element on INPUT field

    - by matra
    I am trying to use :after CSS pseudo element on INPUT field, but it does not work. If I use it with SPAN, it works OK. <style type="text/css"> .mystyle:after {content:url(smiley.gif);} .mystyle {color:red;} </style> This works (puts the smily after "buu!" and berfore "some more") <span class="mystyle">buuu!</span>a some more This does not work - it only color someValue in red, but there is no smiley. <input class="mystyle" type="text" value="someValue"> What am I doing wrong? should I use another pseudo selector. Note: I can not add SPAN sround my INPUT; because it is being generated by a third party control. Matraj

    Read the article

  • CSS :after pseudo element on INPUT field

    - by matra
    Hi, I am trying to use :after CSS pseudo element on INPUT field, but it does not work. If I use it with SPAN, it works OK. <style type="text/css"> .mystyle:after {content:url(smiley.gif);} .mystyle {color:red;} </style> This works (puts the smily after "buu!" and berfore "some more") <span class="mystyle">buuu!</span>a some more This does not work - it only color someValue in red, but there is no smiley. <input class="mystyle" type="text" value="someValue"> What am I doing wrong? should I use another pseudo selector. Note: I can not add SPAN sround my INPUT; because it is being generated by a third party control. Matraj

    Read the article

  • Android : Customizing tabs on state : How do I make a selector a drawable

    - by Chrispix
    I know how to put the icon on each tab, that is no problem. I also ran across this : Stack Overflow thread on pretty much same thing I followed one of the links from that question, and found this Pretty much, it said use a selector defined in the xml, sure, did that. But there is no id associated w/ it so I am not sure how to get the selector function as a drawable so I can use it as the icon for the tabs. Maybe I am going about this the wrong way.. But this is what I have, and obviously missing something. <selector android:id="@+id/myselector" xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/darklogo" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/lightlogo" /> <!-- Focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/lightlogo" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/lightlogo" /> <!-- Pressed --> <item android:state_pressed="true" android:drawable="@drawable/lightlogo" /> </selector> In my code, an example tab is generated using : host.addTab(host.newTabSpec("three") .setIndicator("map",drawables) .setContent(new Intent(this, Map.class))); Right now drawables is just a reference to an drawable image resource. How do I make the selector a drawable? * This is my question *

    Read the article

  • How to implement navigation drawer selector similar to Google Play Music

    - by Shivam Bhalla
    I am looking to implement a navigation drawer selector which shows the currently selected item at all times when the drawer is opened and that is retained even when the drawer is closed. Something like this: I have used something like this but it only shows the selector when I click on the list item. This is in my res folder: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/list_activated_holo" /> </selector> How do i attain the above shown implementation?Which state do i need to implement? Thanks

    Read the article

  • Create New Pseudo Variables in Squeak

    - by Artium
    Large part of squeak is implemented using squeak itself. I am curious to know if pseudo variables such as self or true are also implemented using squeak. If the answer is yes, where the implementation located? Specifically, assume that I want to add new subclass of "Boolean" called "Other" which will represent a third option: neither true nor false. I want that other, the only instance of Other to be similar to the true/false global singletons. Any ideas? Thank you.

    Read the article

  • android: customized text selector

    - by Yang
    I wanted to design a customized text selector that changed the text color when user clicks the TextView. But got the following error: java.lang.RuntimeException: Unable to start activity ComponentInfo{}: android.view.InflateException: Binary XML file line #55: Error inflating class here is what I have: res/text_selector.xml <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_focused="true" android:drawable="@color/black" /> <item android:state_pressed="true" android:drawable="@color/blue" /> <item android:state_focused="true" android:drawable="@color/black" /> </selector> layout/textview.xml <TextView android:id = "@+id/last_page_button" android:text="@string/last_page_button_string" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffffff" android:textColor = "@drawable/text_selector" android:layout_weight="1" /> values/color.xml <resources> <color name="white">#ffffffff</color> <color name="black">#ff000000</color> <color name="blue">#ffccddff</color>

    Read the article

  • Pseudo random numbers in php

    - by pg
    I have a function that outputs items in a different order depending on a random number. for example 1/2 of the time Popeye's and its will be #1 on the list and Taco Bell and its logo will be #2 and half the time the it will be the other way around. The problem is that when a user reloads or comes back to the page, the order is re-randomized. $Range here is the number of items in the db, so it's using a random number between 1 and the $range. $random = mt_rand(1,$range); for ($i = 0 ; $i < count($variants); $i++) { $random -= $variants[$i]['weight']; if ($random <= 0) { $chosenoffers[$tag] = $variants[$i]; break; } } I went to the beginning of the session and set this: if (!isset($_SESSION['rannum'])){ $_SESSION['rannum']=rand(1,100); } With the idea that I could replace the mt_rand in the function with some sort of pseudo random generator that used the same 1-100 random number as a seed throughout the session. That way i won't have to rewrite all the code that was already written. Am I barking up the wrong tree or is this a good idea?

    Read the article

  • Reversible pseudo-random sequence generator

    - by user350651
    I would like some sort of method to create a fairly long sequence of random numbers that I can flip through backwards and forwards. Like a machine with "next" and "previous" buttons, that will give you random numbers. Something like 10-bit resolution (i.e. positive integers in a range from 0 to 1023) is enough, and a sequence of 100k numbers. It's for a simple game-type app, I don't need encryption-strength randomness or anything, but I want it to feel fairly random. I have a limited amount of memory available though, so I can't just generate a chunk of random data and go through it. I need to get the numbers in "interactive time" - I can easily spend a few ms thinking about the next number, but not comfortably much more than that. Eventually it will run on some sort of microcontroller, probably just an Arduino. I could do it with a simple linear congruential generator (LCG). Going forwards is simple, to go backwards I'd have to cache the most recent numbers and store some points at intervals so I can recreate the sequence from there. But maybe there IS some pseudo-random generator that allows you to go both forwards and forwards? It should be possible to hook up two linear feedback shift registers (LFSRs) to roll in different directions, no? Or maybe I can just get by with garbling the index number using a hash function of some sort? I'm going to try that first. Any other ideas?

    Read the article

  • JQuery selector value escaping

    - by user53794
    I have a dropdown list that contains a series of options: <select id=SomeDropdown> <option value="a'b]&lt;p>">a'b]&lt;p></option> <option value="easy">easy</option> <select> Notice that the option value/text contains some nasty stuff: single quotes closing square bracket escaped html I need to remove the a'b]<p option but I'm having no luck writing the selector. Neither: $("#SomeDropdown >option[value='a''b]&lt;p>']"); or $("#SomeDropdown >option[value='a\'b]&lt;p>']"); are returning the option. What is the correct way to escape values when using the "value=" selector?

    Read the article

  • -[CCScene setOffsetx:]: unrecognized selector sent to instance

    - by Alexander Sharunov
    please help me, i'm very new in objective-c i've got 2 simplest classes (bellow first, second) i would like to set the offsetx properties of self.rolypoly object in second class like a self.rolypoly.offsetx=1 or run use [self.rolypoly setOffx]; to do somethings, but i always have the errors: trying [self.rolypoly setOffx]; in second class -[CCScene setOffx:]: unrecognized selector sent to instance 0x91d0b70' or trying self.rolypoly.offsetx=1; in second class -[CCScene setOffsetx:]: unrecognized selector sent to instance 0x808bfc0' first class //************************************************************ #import <Foundation/Foundation.h> #import "cocos2d.h" @interface RolyPoly : CCLayer { CCAction *_walkAction; CCSprite *_rolypoly; int offsetx; int offsety; } @property (nonatomic, retain) CCSprite *rolypoly; @property (nonatomic, retain) CCAction *walkAction; @property (nonatomic, assign) int offsetx; @property (nonatomic, assign) int offsety; +(id) scene; -(void) setOffx; @end //************************************************************ #import "GameLayer.h" #import "RolyPoly.h" @implementation RolyPoly @synthesize rolypoly = _rolypoly; @synthesize walkAction = _walkAction; @synthesize offsetx = _offsetx; @synthesize offsety = _offsety; +(id) scene { CCScene *scene = [CCScene node]; RolyPoly *layer = [RolyPoly node]; [scene addChild: layer]; return scene; } -(id) init { if ((self = [super init])) { [self scheduleUpdate]; } return self; } -(void) setOffx { NSLog(@"setOffx"); } -(void) update:(ccTime)delta { } - (void) dealloc { self.rolypoly = nil; self.walkAction = nil; [super dealloc]; } @end second class //************************************************************ #import <Foundation/Foundation.h> #import "cocos2d.h" #import "RolyPoly.h" @interface GameLayer : CCLayer { RolyPoly *_rolypoly; } // returns a CCScene that contains the HelloWorldLayer as the only child +(CCScene *) scene; @property (nonatomic, assign) RolyPoly * rolypoly; @end //************************************************************ #import "GameLayer.h" #import "RolyPoly.h" // HelloWorldLayer implementation @implementation GameLayer @synthesize rolypoly = _rolypoly; +(CCScene *) scene { CCScene *scene = [CCScene node]; GameLayer *layer = [GameLayer node]; [scene addChild: layer]; return scene; } -(id) init { if( (self=[super init])) { CGSize screenSize = [[CCDirector sharedDirector] winSize]; self.rolypoly = [RolyPoly scene]; [self addChild:self.rolypoly z:1]; [self.rolypoly setOffx]; [self scheduleUpdate]; } return self; } - (void)update:(ccTime)dt { } - (void) dealloc { [super dealloc]; } @end

    Read the article

  • unrecognized selector sent to instance on deviceOrientationDidChange

    - by clopez
    Right now my app should only supports Portrait. On Summary/Supported Device Orientations I have only selected Portrait so I'm hoping that my app will not rotate. I was testing the app on a device and suddenly I'm getting the following error randomly: [UIButtonContent deviceOrientationDidChange:]: unrecognized selector sent to instance It happens when I rotate the device SOMETIMES, is not consistent, and is not always over UIBUttonContent. I supposed that if I only select Portrait, deviceOrientationDidChange should not be called or should be ignored. Other times my app crashes with an EXC_BAD_ACCESS (code=1, address=something) but it happens when I rotate the device so I'm guessing that both errors are related. I don't know what to do with this, it's hard to debug because I don't have feedback, the All Exceptions Breakpoint is not being called, so I don't know where and exactly why this is happening. Any idea on how to debug this is welcome.

    Read the article

  • Background selector declaration in CSS

    - by Shivanand
    Hello, In CSS declaration for a selector is given as: background-attachment: scroll; background-color: transparent; background-image: url(/images/ucc/green/btn-part2.gif); background-repeat: no-repeat; background-position: right top; I want to optimize the code and change it to: background: scroll transparent url(/images/ucc/green/btn-part2.gif) no-repeat right top; My question is, Is this correct way and does it work in IE7/8, Firefox, Safari?

    Read the article

  • JQuery selector in variable

    - by nagut
    I wanted to ask about using selector from a variable first I have: function check() { $('.info input, .info select').each(function(n, element){ if ($(element).val()=='') alert('empty'); }); } and called it in $('input')change(check); and they worked fine. But now I want to pass some value to the function to make it dynamic, like $('input')change(check('.info')); and changed the function to function check(sel) { $(sel +' input, '+ sel + ' select').each(function(n, element){ if ($(element).val()=='') alert('empty'); }); } but it doesn't work. Any help please.. Thanks, nagut

    Read the article

  • How to I pass @selector as a parameter?

    - by erotsppa
    For the method [NSThread detachNewThreadSelector:@selector(method:) toTarget:self withObject:(id)SELECTOR]; How do I pass in a @selector? I tried casting it to (id) to make it compile but it crashes in runtime. More specifically, I have a method like this +(void)method1:(SEL)selector{ [NSThread detachNewThreadSelector:@selector(method2:) toTarget:self withObject:selector]; } it crashes, how do I pass in the selector without crashing? So that the new thread can call the selector when the thread is ready?

    Read the article

  • Problem with jQuery selector and MasterPage

    - by Daemon
    Hi, I have a problem with a master page containing a asp:textbox that I'm trying to access using jQuery. I have read lot sof thread regarding this and tried all the different approaches I have seen, but regardless, the end result end up as Undefined. This is the relevant part of the MasterPage code: <p><asp:Label ID="Label1" AssociatedControlID="osxinputfrom" runat="server">Navn</asp:Label><asp:TextBox CssClass="osxinputform" ID="osxinputfrom" runat="server"></asp:TextBox></p> When I click the button, the following code from a jQuery .js file is run: show: function(d) { $('#osx-modal-content .osxsubmitbutton').click(function (e) { e.preventDefault(); if (OSX.validate()){ $('#osx-modal-data').fadeOut(200); d.container.animate( {height:80}, 500, function () { $('#osx-modal-data').html("<h2>Sender...</h2>").fadeIn(250, function () { $.ajax({ type: "POST", url: "Default.aspx/GetDate", data: "{'from':'" + $("#osxinputfrom").val() + "','mailaddress':'" + $("#osxinputmail").val() + "','header':'Test3','message':'Test4'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $('#osx-modal-data').fadeOut(200, function () { $('#osx-modal-data').html('<h2>Meldingen er sendt!</h2>'); $('#osx-modal-data').fadeIn(200); }); }, error: function(msg){ $('#osx-modal-data').fadeOut(200, function () { $('#osx-modal-data').html('<h2>Feil oppstod ved sending av melding!</h2>'); $('#osx-modal-data').fadeIn(200); }); } }); }); } ); } else{ $('#osxinputstatus').fadeOut(250, function () { $('#osxinputstatus').html('<p id="osxinputstatus">' + OSX.message + '</a>'); $('#osxinputstatus').fadeIn(250); }); } }); }, So the problem here is that $("#osxinputfrom").val() evaluated to Undefined. I understand that the masterpage will add some prefix to the ID, so I tried using the ID from the page when it's run that ends up as ct100_osxinputfrom, and I also tried some other hinds that I found while searching like $("#<%=osxinputfrom.ClientID%"), but it ends up as Undefined in the method that is called from the jQuery ajax method anyway. The third and fourth parameters to the ajay function that is hardcoded as Test3 and Test4 comes fine in the C# backend method. So my question is simply: How can I rewrite the jQuery selector to fetch the correct value from the textbox? (before I used master pages it worked fine by the way) Best regards Daemon

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >