How to restrict mouse scroll to modal? - popup

I have a modal with scrollable content that works fine using overflow-y: scroll;
Problem is, when using the mouse wheel to scroll inside the modal and you reach the end of the content, the main page then scrolls. My client has asked me to prevent this from happening. Is this possible?

To achieve this I used the "show" and "hide" events of the modal. I'm using Twitter Bootstrap modal so they have these events, but I guess any good modal plugin will have them. For the "show" event, I binded a function that removes scrolling on the body. For the "hide" event, I binded a function that reenables it. Here's how I did it:
modal = $('#myModal');
modal.on('show', function () {
// disable background scrolling
$('body').css('overflow', 'hidden');
});
modal.on('hide', function () {
// enable background scrolling
$('body').css('overflow', 'auto');
});
You can of course disable/enable scrolling on the container of your choice. Hope this helps.

Related

Scrolling fails if clicking on child

I have a UIScrollView which has a bunch of UIButtons as children.
If I click outside of these buttons, I am able to scroll the UIScrollView. However, if I try to scroll by clicking on one of these buttons, the scrollview doesn't work.
Each button is registered to listen to UIControlEventTouchUpInside.
Any ideas?
If you're touching the button and hoping to scroll, then you should be linking to the UIControlEventTouchDownInside event, not outside!
Additionally, you have to pass the touch event to the underlying UIScrollView to make the scrolling happen. The app is actually trying to do you a favor by letting you click the button and not scrolling the table.
Good luck

Disabling Scrolling on NIPagingScrollView

i am using Nimbus kit for my app. I have different Page Scroll Views. Each Page have a button. when i click on the button i need to go to next page. for that i am using
[self.pagingScrollView moveToNextAnimated:YES]; . It works fine. But i need to disable to horizontal scrolling of a page. NIPagingScrollView is a subclass of UIView, so i can't use a scrollEnabled property. How can i dsiable scrolling on NIPagingScrollView. I don't want a user to swipe next/previous of the screen.
Thanks,
You can access the paging scroll view via the pagingScrollView property on NIPagingScrollView.

iPhone4 how to add/animate a UIView to appear under a UIButton?

I have a "side panel" like widget in my app that can be swiped in from the side of the screen. In order to help the users find the panel, I also added a UIButton to do the same thing - scroll the panel on and off screen.
The view comes from a different view controller, otherwise I would've simply created an extra panel in the interface builder and positioned it properly.
My problem is that the side panel gets positioned over the button, so if it is displayed with a button, it can only be dismissed with a gesture.
is it possible to specify at which "depth" I add a UIView when I programmatically add it in code?
This is the snipped that slides the panel in or out within the animation block.
self.audioSystemController.view.frame =CGRectMake(0,20, 120,460);
I need the UIView to be shown below a UIButton, so the button may be used to dismiss the view. I know this is redundant, but I cannot depend on the users to simply discover the side swiping gestures :/
Thank you for your help!
Check out the insertSubview:belowSubview: method of UIView.

appcelerator tableview autosliding

Using Appcelerator:
I have a form, a tableView with textFeilds
I want it so when I focus on them, it slides the window or the view to the top, under the navigation bar.
Right now, the keyboard is blocking the last few rows.
Do I need a listener on each form to slide? If so how do you do that?
You could add a focus listener to each of your textFields.
Then you should be able to move the tableview using scrollToTop or scrollToIndex.
If there are a fixed number of textfields you might want to try using a scrollview instead of a tableview. This will handle the move-up action for you when the individual taps in a textfield.

Button events inside UIWebView

I want to have a on top of uiwebview, which will scroll out of view as I scroll webview downward. The problem is I am not able to raise/handle the button touchupinside event from the viewcontroller. My guess is webview is eating the event. How can I make the button raise events?
One solution is to have a subview containing the button and then have this and the webview inside a scrollview. However this has its own problems and more so because my webpage has expandable sections inside it.
I am currently adding the button as subview inside documentview of the uiwebview, so it scrolls out of view.
Any help in this regard will be appreciated. Thanks.
It's a WebView, so if you're button is actually on the webpage, just use a simple Name attribute on the anchor tag.
If it's not, and it's a UIButton event you are trying to listen to, chances are you wired something up incorrectly with your IBOutlets and IBActions. To send a message to a UIWebView to make it scroll, you can send the stringByEvaluatingJavaScriptFromString: message which will call javascript inside your page. Check out the docs for details.