- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
制作起来很麻烦,而且由于我在 SO 贡献者的帮助下将它放在一起,所以发布结果似乎很公平(作为答案,如下)。如果您正在寻找涉及 iOS 和 Core Text 中的属性字符串和滚动的示例,这里有它们的集合。
一些额外的要点:
包装:
这是由属性字符串的 lineBreakMode 完成的,默认为换行。您将无法从字符串中检索软换行符(不像在 Cocoa 中,NSTextView 在字符串中放置‘\n’字符)。但你不需要。您可以依靠 Core Text 的 Framesetter 为您提供字符串在给定框架中的高度——只要您将前导信息放入属性字符串中即可。
CATextLayer:
使用起来很方便。您所要做的就是分配一个属性字符串,然后它会换行和绘制。如果您有一个短字符串要用选定的字体显示,那就太好了。但是 CATextLayer 不识别前导或缩进,所以对于这个项目,我直接绘制到 CALayer。
字体:
我大部分时间都坚持使用 CTFontRef,因为它是在 iOS 中构建属性字符串所必需的,并且它提供准确的前导,但有时使用 UIFont 更容易。下面是将 CTFontRef (fontr
) 转换为 UIFont 的方法:
NSString *sFontName = (NSString *)CTFontCopyName(fontr, kCTFontPostScriptNameKey);
UIFont *font = [UIFont fontWithName:sFontName size:CTFontGetSize(fontr)];
CGSize sizeString = [string sizeWithFont:font];
[sFontName release];
如果您从头开始创建 UIFont,请注意它会在字体名称的家族部分接受空格,或者您可以将它们拼在一起,但“粗体”必须用连字符分隔:
self.fontTickerNormal = [UIFont fontWithName:@"Helvetica Neue"
size:18.0f]; // OK
self.fontTickerIndent = [UIFont fontWithName:@"HelveticaNeue"
size:16.0f]; // OK too
self.fontTickerBold = [UIFont fontWithName:@"HelveticaNeue-Bold"
size:18.0f]; // both the smash and the hyphen are required
CTFontRef 更直接。所有名称部分都可以用空格分隔。以下工作正常:
self.fontrTickerBold = CTFontCreateWithName((CFStringRef)@"Helvetica Neue Bold", 18.0f, NULL);
要遵循的答案示例...
最佳答案
准备组件:大多数示例更易于阅读,因为它们将字符串及其属性全部组合在一个地方(即 clear example ),但如果您不挂起所有组件,当 View 使用字符串,因此最好在 UIViewController 的 viewDidLoad 中设置所有内容:
- (void)viewDidLoad {
[super viewDidLoad];
// FONTS ETC.
// Prepare fonts for the ticker display.
self.fontrTickerNormal = CTFontCreateWithName((CFStringRef)@"Helvetica Neue", 18.0f, NULL);
self.fontrTickerBold = CTFontCreateWithName((CFStringRef)@"Helvetica Neue Bold", 18.0f, NULL);
self.fontrTickerIndent = CTFontCreateWithName((CFStringRef)@"Helvetica Neue", 16.0f, NULL);
// Determine width of bullet sub-indent
// (Use a UIFont and UIKit's sizeWithFont. No need to fuss with framesetter and leading here; all we need is width.)
UIFont *fontTickerIndent_uif = [UIFont fontWithName:@"Helvetica Neue" size:16.0f];
NSString *stringWithBullet = [NSString stringWithUTF8String:"\u2022"]; // bullet char
NSString *stringWithBulletPlusSpace = [stringWithBullet stringByAppendingString:@" "];
CGSize sizeBulletPlusSpace = [stringWithBulletPlusSpace sizeWithFont:fontTickerIndent_uif];
self.fWidthBulletPlusSpace = sizeBulletPlusSpace.width;
// Prepare bulleted string to which text can be appended
NSString *stringBulletBuild = [@"\n" stringByAppendingString:stringWithBullet];
stringBulletBuild = [stringBulletBuild stringByAppendingString:@"\t"];
self.sBulletedLineBreak = stringBulletBuild;
// Initialize the collections that will hold onto the individual strings and dicts via alloc, as opposed to an autoreleased method, so that we can control the order in which they are released in viewDidUnload. (If dicts were to be released before the strings that use them, there would be a bad-access crash):
NSMutableArray *asmarrTickerStringsNew = [[NSMutableArray alloc] initWithCapacity:20]; // guess
self.asmarrTickerStrings = asmarrTickerStringsNew;
[asmarrTickerStringsNew release];
NSMutableArray *dmarrTickerAttributesNew = [[NSMutableArray alloc] initWithCapacity:20]; // one per string
self.dmarrTickerAttributes = dmarrTickerAttributesNew;
[dmarrTickerAttributesNew release];
// Don't initialize the cumulative-string ppty (mattrStgr) here. There is no way of appending to an empty CFMutableAttributedStringRef, so you have to wait till the first string goes through addProgressTickerLine.
// STYLE SETTINGS:
// paragStyleNormal:
CFIndex countSettings = 3; // normal and bold styles both have 3 settings
// - left alignment (the default, but just in case)
CTTextAlignment alignment = kCTLeftTextAlignment;
CTParagraphStyleSetting styleAlignLeft = { kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment };
// - wrapping (again the default, but just in case)
CTLineBreakMode wrapping = kCTLineBreakByWordWrapping;
CTParagraphStyleSetting styleWrapped = { kCTParagraphStyleSpecifierLineBreakMode, sizeof(CTLineBreakMode), &wrapping };
// - normal leading (so framesetter calculates the correct height)
CGFloat fLeadingNormal = CTFontGetLeading(self.fontrTickerNormal);
CTParagraphStyleSetting styleLeadingNormal = { kCTParagraphStyleSpecifierLineSpacingAdjustment, sizeof(CGFloat), &fLeadingNormal };
CTParagraphStyleSetting arrSettingsNormal[] = { styleAlignLeft, styleWrapped, styleLeadingNormal };
self.paragStyleNormal = CTParagraphStyleCreate(arrSettingsNormal, countSettings);
// paragStyleBold:
// - bold leading (otherwise this style is same as normal)
CGFloat fLeadingBold = CTFontGetLeading(self.fontrTickerBold);
CTParagraphStyleSetting styleLeadingBold = { kCTParagraphStyleSpecifierLineSpacingAdjustment, sizeof(CGFloat), &fLeadingBold };
CTParagraphStyleSetting arrSettingsBold[] = { styleAlignLeft, styleWrapped, styleLeadingBold };
self.paragStyleBold = CTParagraphStyleCreate(arrSettingsBold, countSettings);
// paragStyleIndent:
// - indented leading (font is smaller)
CGFloat fLeadingIndent = CTFontGetLeading(self.fontrTickerIndent);
CTParagraphStyleSetting styleLeadingIndent = { kCTParagraphStyleSpecifierLineSpacingAdjustment, sizeof(CGFloat), &fLeadingIndent };
// - Indent the first line up to the bullet.
CGFloat indentFirstLineHead = 15.0f;
CTParagraphStyleSetting styleFirstLineHeadIndent = { kCTParagraphStyleSpecifierFirstLineHeadIndent, sizeof(CGFloat), &indentFirstLineHead };
// - Add a tab stop to allow for the bullet and some following space.
self.tabStop = CTTextTabCreate(alignment, (double)self.fWidthBulletPlusSpace, NULL);
CTTextTabRef tabStopPtr[] = { self.tabStop };
self.cfarrTabStop = CFArrayCreate(NULL, (const void **) tabStopPtr, 1, NULL);
CTParagraphStyleSetting styleTabStops = { kCTParagraphStyleSpecifierTabStops, sizeof(CTTextTabRef), &cfarrTabStop };
// - Indent the wrapped lines to the same point as the tab stop.
CGFloat indentHead = indentFirstLineHead + self.fWidthBulletPlusSpace;
CTParagraphStyleSetting styleHeadIndent = { kCTParagraphStyleSpecifierHeadIndent, sizeof(CGFloat), &indentHead };
// Put paragStyleIndent together.
countSettings += 3; // 3 style settings added (firstLineHeadIndent, tabStop, and HeadIndent)
CTParagraphStyleSetting arrSettingsIndent[] = { styleAlignLeft, styleWrapped, styleLeadingIndent, styleFirstLineHeadIndent, styleTabStops, styleHeadIndent };
self.paragStyleIndent = CTParagraphStyleCreate(arrSettingsIndent, countSettings);
// LAYER AND SCROLLVIEW
// Set up the layer for the progress ticker.
CGSize sizeTicker = self.svProgressTicker.layer.bounds.size;
// Frame the layer:
/*
- Don't add any padding to the X origin; the scrollview apparently figures some into its bounds automatically.
- Do add some padding to the Y origin; otherwise the first string will hug the top.
- Decrease the width to allow for the scrollbar, which the scrollview bounds do not account for.
- Height is 0 for now, since it doesn't have any strings yet.
*/
CGRect rectTickerInset = CGRectMake(0.0f, kMargin, sizeTicker.width - kMargin, 0.0f);
CALayer *layerTicker = [CALayer layer];
[layerTicker setFrame:rectTickerInset];
// Assign this controller as the delegate and add it to the scrollview's root layer.
// (See headnote to the drawLayer method.)
[layerTicker setDelegate:self];
self.layProgressTicker = layerTicker;
[svProgressTicker.layer addSublayer:self.layProgressTicker];
// Set the scrollView's contentSize per the layer's frame -- which will become taller with each appended string until it exceeds the scrollView's bounds.
[self.svProgressTicker setContentSize:CGSizeMake(rectTickerInset.size.width, rectTickerInset.size.height)];
[self.svProgressTicker setClipsToBounds:YES]; // otherwise the contents will overflow the border.
}
追加字符串:
(使用这些常量:)
#define kTickerStyleNormal 0
#define kTickerStyleIndent 1
#define kTickerStyleBold 2
#define kTickerStyleFirstLine 3
/**
Appends the string arg to the Progress Ticker scrollView, styled per uiStyle.
Note: String arg should NOT have any line breaks.
*/
- (void) addProgressTickerLine:(NSString *)string
inStyle:(uint8_t)uiStyle {
// Determine the font.
CTFontRef fontr = nil;
switch (uiStyle) {
case kTickerStyleNormal:
fontr = self.fontrTickerNormal;
break;
case kTickerStyleIndent:
fontr = self.fontrTickerIndent;
break;
case kTickerStyleBold:
fontr = self.fontrTickerBold;
break;
case kTickerStyleFirstLine:
fontr = self.fontrTickerBold;
break;
default:
fontr = self.fontrTickerNormal;
break;
}
// Prepare the paragraph style (preassembled in viewWillAppear), to govern inter-line height and indentation.
// At the same time, add the initial line break.
CTParagraphStyleRef paragStyle = NULL;
switch (uiStyle) {
case kTickerStyleNormal:
string = [@"\n" stringByAppendingString:string];
paragStyle = self.paragStyleNormal;
break;
case kTickerStyleBold:
// For main un-indented lines, simply add a line break.
string = [@"\n" stringByAppendingString:string];
paragStyle = self.paragStyleBold;
break;
case kTickerStyleFirstLine: {
paragStyle = self.paragStyleBold;
// No line break for the first line.
// (Q: Why not avoid this case by putting line break at the end, rather than the beginning?)
// (A: The indented string would then require 2 steps to sandwich it between the bullet-tab and the line break.)
break;
}
case kTickerStyleIndent: {
// For indented bullet lines, prepend lineBreak-bullet-tab to the string.
string = [self.sBulletedLineBreak stringByAppendingString:string];
// Assign the indented paragStyle.
paragStyle = self.paragStyleIndent;
break;
}
default: // just in case
paragStyle = self.paragStyleNormal;
break;
}
// Determine the text (foreground) color per...
UIColor *colorHSV = [UIColor blueColor]; // switch-case omitted
// PUT IT ALL TOGETHER.
// Combine the above into a dictionary of attributes.
CFStringRef keys[] = { kCTFontAttributeName, kCTParagraphStyleAttributeName, kCTForegroundColorAttributeName };
CFTypeRef values[] = { fontr, paragStyleIndent, colorHSV.CGColor };
CFDictionaryRef dictr = CFDictionaryCreate(NULL,
(const void **)&keys,
(const void **)&values,
sizeof(keys) / sizeof(keys[0]),
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
[self.dmarrTickerAttributes addObject:(id)dictr]; // provides for release
// Use the attributes dictionary to make an attributed string out of the plain string.
CFAttributedStringRef attrStgr = CFAttributedStringCreate(kCFAllocatorDefault, (CFStringRef)string, dictr);
[self.asmarrTickerStrings addObject:(id)attrStgr]; // provides for release
// Adding an object to a collection increments its retain count, so attrStgr are now at count 2 and should be decremented to 1; they will be brought to 0 upon release of the collections.
CFRelease(attrStgr);
CFRelease(dictr);
// If cumulative attrStg is nil, initialize it with a maxLength of 0 to indicate that it is unlimited.
if (!self.mattrStgr)
self.mattrStgr = CFAttributedStringCreateMutableCopy(kCFAllocatorDefault, 0, attrStgr);
// Else append the newly completed attrStg, using the method suggested in the CFMutableAttributedString class ref overview.
else {
CFRange rangeAppend = CFRangeMake(CFAttributedStringGetLength(self.mattrStgr), 0);
CFAttributedStringReplaceAttributedString(self.mattrStgr, rangeAppend, attrStgr);
}
// DISPLAY IT.
// Now that the new string has been appended, call the method that will adjust the contentSize, trigger the draw method, and scroll to the end.
[self adjustProgressTickerFrame];
// Do NOT release attrstg or any of its styling components here. They are needed cumulative string property is voided. They have been propertized so that they can be released in dealloc (here in viewDidUnload).
}
调整高度,调用drawLayer,滚动到底部:
/**
Adjust the height of the scrollView and its content layer to accommodate newly appended strings and/or orientation change, redraw the layer, and scroll to the bottom.
Called at the end of addProgressTickerLine and upon willAnimateRotationToInterfaceOrientation.
*/
- (void) adjustProgressTickerFrame {
// Get the width within which the text has to fit in the view's current frame.
CGSize sizeTickerView = self.svProgressTicker.layer.bounds.size;
CGFloat fWidthInset = sizeTickerView.width - kMargin;
// Make a framesetter in order to get the size of the cumulative string.
/*
Note re Leading:
- The framesetter will suggest too short a height unless the attributed string has paragraphStyle attributes that specify the leading.
- But if you attempt to do an efficient setNeedsDisplay:InRect routine, drawing only the last-appended string per its individual height, framesetter will report the the hard line breaks as a full line, not just as leading, so you'll end up with dimensions that are much too tall. There's no choice but to get the full size and draw the full cumulative string each time.
*/
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(self.mattrStgr);
CFIndex length = CFAttributedStringGetLength(self.mattrStgr);
CFRange textRange = CFRangeMake(0, length);
CFRange fitRange;
CGSize sizeString = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, textRange, NULL, CGSizeMake(fWidthInset, CGFLOAT_MAX), &fitRange);
// Round the reported height up. Dimensions are reported as very precise fractions, but framing and drawing is by whole pixels.
CGFloat fHeight = ceilf(sizeString.height);
// Reframe the layer.
CGRect rectTickerInset = CGRectMake(0.0f, kMargin, sizeTickerView.width - kMargin, fHeight);
[self.layProgressTicker setFrame:rectTickerInset];
// Adjust the scrollView's contentSize.
// (It should be slightly taller than the layer, to add padding at top and bottom.)
[self.svProgressTicker setContentSize:CGSizeMake(fWidthInset, (fHeight + (kMargin*2)))];
// Redraw the entire layer.
[self.layProgressTicker setNeedsDisplay];
// If the layer is now taller than the scrollView's bounds, scroll down.
// Do NOT use animation.
// (If you do when the view first appears, it won't scroll down far enough, should the view be assigned lots of string content initially. (Presumably the initial autorotation anim prevents this one from being completed.) And afterwards, it doesn't make any difference; there's a spring action that happens regardless.)
CGFloat fHeightExcess = fHeight - (sizeTickerView.height - (kMargin*2));
if (fHeightExcess > 1.0f)
[self.svProgressTicker setContentOffset:CGPointMake(0.0f, fHeightExcess) animated:NO];
}
绘制:
/**
CALayer's delegate method for drawing its content, triggered by calling setNeedsDisplay on the layer.
This controller is assigned as the layer's delegate, and calls setNeedsDisplay when:
1) a string is appended
2) the device is rotated into a different aspect ratio
Q: Why not subclass UIScrollView and have IT be the delegate? After all, the class ref says the view associated with the layer must be the delegate.
A1: Apparently "associated" in Apple-speak means as in view to its ROOT layer. Sublayers can have any delegate you choose.
A2: If scrollView is the delegate and does the content drawing, the app will crash. ScrollView probably issues setNeedsDisplay:inRect: gazillions of times as it scrolls, overwhelming the processor.
*/
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
// Get the rect of the entire area available for drawing.
// (We cannot use the layer's frame rect directly because it has origin insets; they would be doubled if used here too.)
CGRect drawingRect = CGRectMake(0.0f, 0.0f, self.layProgressTicker.frame.size.width, self.layProgressTicker.frame.size.height);
// Turn the context upside down to match the layer's orientation.
// (The context origin is at the lower left, whereas the layer origin is at the upper left.)
CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
CGContextTranslateCTM( ctx, drawingRect.origin.x, drawingRect.size.height );
CGContextScaleCTM( ctx, 1, -1 );
// Make a rectangular path in which to draw.
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, drawingRect);
// Use Core Text's framesetter to frame the cumulative (mutable) attributed string inside the rectangular path.
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(self.mattrStgr);
CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
CFRelease(framesetter); // ok to release here; it's not part of "frame"
CFRelease(path);
// Draw the framesetter frame.
CTFrameDraw(frame, ctx);
CFRelease(frame);
}
自转:
/*
Autorotation methods are called in this order:
1) shouldAutorotate
2) willRotate
3) willAnimate
4) didRotate
*/
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
// Return YES to support all 4 orientations.
return YES;
}
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// "When this method is called, the interfaceOrientation property still contains the view’s original orientation." (So hang onto it.)
// You can't wait until willAnimate because, by then, that property will have been set to the new orientation.
// Which leaves a mystery: The didRotateFromInterfaceOrientation is called AFTER willAnimate, and at that point the view controller still is able to send in the fromInterfaceOrientation arg.
self.bFromPortrait = UIInterfaceOrientationIsPortrait([self interfaceOrientation]);
}
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// If rotating from portrait to landscape or vice versa, the text layers need adjustment.
BOOL bToPortrait = UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
if (self.bFromPortrait != bToPortrait)
[self adjustProgressTickerFrame];
}
我想我做对了:下面是卸载所有这些东西的方法(保留的属性也在 dealloc 中释放):
- (void)viewDidUnload {
// It's unlikely that this view will go away and then come back, so viewDidLoad assumes all properties are null -- therefore nullify/release EVERYTHING here.
self.svProgressTicker = nil;
self.layProgressTicker = nil;
self.vSyncInstructions = nil;
self.tlSyncInstructions = nil;
self.btnSyncEtc = nil;
// Release the cumulative attributed string BEFORE releasing any of its component strings.
CFRelease(self.mattrStgr);
// Nullifying the retained collections will release them -- and their contents, whose retainCounts were incremented upon addition to the collection. So it's important to nullify the strings collection first, then the attr dicts.
self.asmarrTickerStrings = nil;
self.dmarrTickerAttributes = nil;
// Now we can release the "created" settings, then their components.
CFRelease(self.paragStyleNormal);
CFRelease(self.paragStyleBold);
CFRelease(self.paragStyleIndent);
CFRelease(self.tabStop);
CFRelease(self.cfarrTabStop);
CFRelease(self.fontrTickerNormal);
CFRelease(self.fontrTickerBold);
CFRelease(self.fontrTickerIndent);
CFRelease(self.fontrInstructions);
self.fontInstructionsBenchmark = nil;
[super viewDidUnload];
}
关于objective-c - RE : autorotating, 带有属性字符串的滚动、带项目符号、缩进的 UIScrollView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10149389/
如果附加了 'not-scroll' 类,我希望我的 body 不滚动,否则它应该正常工作。 我已经搜索这个问题两天了,但找不到任何适合我的解决方案。 我想要的是向 body 添加一个 class,并
我发现似乎是 iOS Safari 中的错误(我正在 iOS 8 上进行测试)。当绝对定位的 iFrame 漂浮在一段可滚动内容上方时,滚动 iFrame 也会滚动下面的内容。以下 HTML (ava
我有以下代码来显示一系列投资组合图片,这些图片以 SVG 格式存储在滚动 div 中: 在 Safari 中滚动使用两根手指或鼠标滚轮当光标位于 SVG 之一上时不起作用。 该页
我想用 javascript 做的是: 一旦你向下滚动页面,将#sidebar-box-fixed 的位置从 position: relative; 更改为定位:固定;。改回position:rela
我对 Elasticsearch 的滚动功能有点困惑。在 elasticsearch 中,每当用户在结果集上滚动时,是否可以每次调用搜索 API?来自文档 "search_type" => "scan
我试图做到这一点,以便当我向上或向下滚动页面时,它会运行不同的相应功能。我发现了一个类似的问题here但我已经尝试了他们的答案并且没有运气。 注意:此页面没有正常显示的滚动条。没有地方可以滚动。 bo
(C语言,GTK库) 在我的表单上,我有一个 GtkDrawingArea 小部件,我在上面使用 Cairo 绘制 GdkPixbufs(从文件加载)。我想要完成的是能够在窗口大小保持固定的情况下使用
最近我一直在尝试创建一个拉到(刷新,加载更多)swiftUI ScrollView !!,灵感来自 https://cocoapods.org/pods/SwiftPullToRefresh 我正在努
我正在开发一个应用程序,其中有两个带有可放置区域的列表和一个带有可拖动项目的侧面菜单。 当我滚动屏幕时,项目的位置困惑。 我试图在谷歌上寻找一些东西,最后得到了这个问题:jQuery draggabl
我在 UIWebView 中加载了一个 HTML 表单,而我的 UIWebView 恰好从 View 的中间开始并扩展。我必须锁定此 webView 不滚动并将其放在 ScrollView 之上以允许
如何在每个元素而不是整个元素上应用淡入淡出(与其高度相比)? HTML: CSS: * { padding: 0; margin: 0; box-sizing: border
我想使用带有垂直轴的 PageView 并使用鼠标滚动在页面之间移动,但是当我使用鼠标滚动时页面不滚动...仅页面单击并向上/向下滑动时滚动。 有什么办法吗? 我想保留属性 pageSnapping:
我制作这个程序是为了好玩,但我被卡住了,因为程序在屏幕外运行。如何在不完全更改代码的情况下实现滚动条。 public static void main(String args[]) throws IO
我想使用带有垂直轴的 PageView 并使用鼠标滚动在页面之间移动,但是当我使用鼠标滚动时页面不滚动...仅页面单击并向上/向下滑动时滚动。 有什么办法吗? 我想保留属性 pageSnapping:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
使用 jquery 技术从 css-tricks.com 获得滚动/跟随侧边栏,如果您不知道我在说什么,这里是代码: $(function() { var $sidebar = $
我是 jQuery Mobile 新手。我需要向我的应用程序添加 Facebook 滑动面板功能。 我经历了 sliding menu panel ,它工作正常,但我在菜单面板中的内容超出了窗口大小,
有没有办法在 js 或 jQuery 或任何其他工具中检测 ctrl + 滚动。我正在尝试执行一些动态布局代码,我需要检测不同分辨率下的屏幕宽度,我通过使用 setTimeout() 的计时器实现了这
我有一部分html代码:
我想控制 RichTextBox 滚动,但在控件中找不到任何方法来执行此操作。 这样做的原因是我希望当鼠标光标位于 RichTextBox 控件上时鼠标滚轮滚动有效(它没有事件焦点:鼠标滚轮事件由表单
我是一名优秀的程序员,十分优秀!