Multiple types of onmouseover="bigImg(this)" one one sheet - onmouseover

I'm such a novice and I'm sure there is a simple solution so I humbly ask for your assistance.
I have a page that has two different types of image buttons; square and rectangle. The 'onmouseover="bigImg(this)"' works great with the square images but when it comes to the rectangular image button, it scrunches it up to try and make a square.
I know that the image size is defined like this:
function bigImg(x) {
x.style.height = "64px";
x.style.width = "64px";
}
function normalImg(x) {
x.style.height = "32px";
x.style.width = "32px";
}
My problem is that it applies to the rectangular image buttons too.
Question: Is there a way to make those "functions" into a class or id where I could specify it on the code...
OR is there a better solution?

I found a sloppy solution where I resize my long button on Photoshop to work with the same heights as the other icons. I set the width = "auto".
If any anyone has a more elegant solution, please, please, please let me know.
Thank you.

As a newbie, I find a lot of answers here. Thank you all for your posts.
On this one, I just showed you all how much of a newbie I am...
BigImg is just a name, not a function. I just changed BigImg to BigButton and I was able to isolate the buttons from everything else.
Hope this helps anyone else that was in my shoe.

Related

How to resize the element using jsPlumb?

In my application I need to resize the elements. Here I found the perfect example
[http://jsfiddle.net/sporritt/HUKMC/9/][1]
but its not working in my code.
Even when I used the same code without changing it, it didn't work for me.
Any help?
Thank you!
Without posting your code it is difficult to debug. Make sure that the object which is resizable is set with below class:
$('#resizable').addClass('ui-widget-content');

legend on each point with pylab.plot

I would like to have each exact value as a legend above each point representing that value on my graph. Any idea of how I can do it? Thanks
enter code here
Use the annotate method of matplotlib. If you provide some example code, I'll show you how you could use it. Otherwise, the documentation and the examples of matplotlib are quite nice.

exit button .swf file

I've been into forums and other sites that have answered this question. They've given this code:
on(release) {
fscommand("quit");
}
but it doesn't work for me. Can anyone help me?
try putting it on a different layer. put something on the layer like a transparent box, or else the frame will be ignored.
on(press)
{fscommand("quit","true");
}

UILables, Text Flow and Layouts

Consider the following, I have paragraph data being sent to a view which needs to be placed over a background image, which has at the top and the bottom, fixed elements (fig1)
Fig1.
My thought was to split this into 4 labels (Fig1.example2) my question here is how I can get the text to flow through labels 1 - 4 given that label 1,2 & 3 ar of fixed height. I assumed here that label 3 should be populated prior to 4 hence the layout in the attached diagram.
Can someone suggest the best way of doing this with maybe an example?
Thanks
Wish I could help more, but I think I can at least point you in the right direction.
First, your idea seems very possible, but would involve lots of calculations of text size that would be ugly and might not produce ideal results. The way I see it working is a binary search of testing portions of your string with sizeWithFont: until you can get the best guess for what the label will fit into that size and still look "right". Then you have to actually break up the string and track it in pieces... just seems wrong.
In iOS 6 (unfortunately doesn't apply to you right now but I'll post it as a potential benefit to others), you could probably use one UILabel and an NSAttributed string. There would be a couple of options to go with here, (I haven't done it so I'm not sure which would be the best) but it seems that if you could format the page with html, you can initialize the attributed string that way.
From the docs:
You can create an attributed string from HTML data using the initialization methods initWithHTML:documentAttributes: and initWithHTML:baseURL:documentAttributes:. The methods return text attributes defined by the HTML as the attributes of the string. They return document-level attributes defined by the HTML, such as paper and margin sizes, by reference to an NSDictionary object, as described in “RTF Files and Attributed Strings.” The methods translate HTML as well as possible into structures of the Cocoa text system, but the Application Kit does not provide complete, true rendering of arbitrary HTML.
An alternative here would be to just use the available attributes, setting line indents and such according to the image size. I haven't worked with attributed strings at this level, so I the best reference would be the developer videos and the programming guide for NSAttributedString. https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/AttributedStrings/AttributedStrings.html#//apple_ref/doc/uid/10000036-BBCCGDBG
For lesser versions of iOS, you'd probably be better off becoming familiar with CoreText. In the end you'll be rewarded with a better looking result, reusability/flexibility, the list goes on. For that, I would start with the CoreText programming guide: https://developer.apple.com/library/mac/#documentation/StringsTextFonts/Conceptual/CoreText_Programming/Introduction/Introduction.html
Maybe someone else can provide some sample code, but I think just looking through the docs will give you less of a headache than trying to calculate 4 labels like that.
EDIT:
I changed the link for CoreText
You have to go with CoreText: create your AttributedString and a CTFramesetter with it.
Then you can get a CTFrame for each of your textboxes and draw it in your graphics context.
https://developer.apple.com/library/mac/#documentation/Carbon/Reference/CTFramesetterRef/Reference/reference.html#//apple_ref/doc/uid/TP40005105
You can also use a UIWebView

Simulate "Slide to Unlock" in MobileSubstrate

There is a way to simulate the Slide To Unlock in the lockscreen? I've been looked for this in SBAwayController, but without any results :( Have anyone an idea?
I believe (if I understand your question correctly) you want to have the lockbar "unlock itself". For something like that you want to look into SBAwayView, not SBAwayController. In that class there are different methods that interact with the different lockbars. You will want to specifically look at the SBAwayLockBar which is a sublcass of TPBottomLockBar (defined in <TelephonyUI/TPBottomLockBar.h>)
You will have to poke around in the headers and see if there is any way to access the lockbar's Knob position.
Hope that helped at least a bit.