Lost Password
Create an Account

Your username must be unique, and cannot be changed later.

We use your email address to email you a secure password and verify your account.

Wink kitchen sink question

HomeForumsGetting startedWink kitchen sink question

This topic has 2 voices, contains 7 replies, and was last updated by  keyclipse 391 days ago.

Viewing 8 posts - 1 through 8 (of 8 total)
April 19, 2012 at 4:10 am #link

I m very noob in javascript and Wink toolkit so forgive me if the question seems basic. I would like to know how you implement that half reveal page in kitchen sink. To be more specific it is a page that is revealed when you press the top left button in the first page of kitchensink.

April 19, 2012 at 6:23 am #link

Hi,

Well, I made you a picture it will be easier :)

So you have a wrapper which will contain both the options panel (the one that’s is revealed when you click on the top left button) and the “container” which will itself contain 2 pages (the one containing the list of components and the one where we will display the test pages).

The wrapper is 100% of the page width and 100% of the page height and it must have an hidden overflow (to prevent you from seing the right side of the “container”).

The options panel is in a relative position and must stick to the left of the wrapper. It will only be your page width-81px

The “container” must be 200% of you wrapper width. It will be in absolute position (top: 0 and left: 0) so it covers the options panel.

Now you’ll just have to translate the “container”, all other parts remain in place.

if you want to display the options panel:

 wink.fx.applyTranslate(wink.byId('container'), window.innerWidth - 81, 0);

if you want to display “page 1″ of the “container:

 wink.fx.applyTranslate(wink.byId('container'), 0, 0);

if you want to display “page 2″ of the “container:

 wink.fx.applyTranslate(wink.byId('container'), -window.innerWidth, 0);

Of course, you’ll also have to add transitions on the container first so that it moves with a slide effect. What we do here, is that we apply an “ease-in-out” translation when we open or close the options panel and we apply a “linear” translation when we move from “page1″ to “page2″

For instance:

wink.fx.apply(wink.byId('container'), {'transition-timing-function': 'ease-in-out'});

You’ll find those various piece of code in “options.js”, “list.js” and “test.js”.

I hope it will help you understand the kitchensink layout ;)

Jérôme

April 19, 2012 at 6:27 am #link

Nice and smart Jerome.
I gotta say im really impressed by this toolkit. Please excuse me if I ask more questions regarding this toolkit and thanks for the explanation.

April 23, 2012 at 6:34 am #link

Hi Jerome I would am trying to implement this “option” capability in your example web app. However I do not succeed in applying your asyncpanels in the wrapper div.

can you kindly advise me what is happening?

  • This reply was modified 392 days ago by  keyclipse.
  • This reply was modified 392 days ago by  keyclipse.
  • This reply was modified 392 days ago by  admin.
April 23, 2012 at 6:42 am #link

Sorry can you ignore the previous post the forum markup was not doing well

so this is the html code that is modified from tutorial

	<body>
        <div id="wrapper" class="wrapper">
            <div class="w_header_custom">
                <div id="back" class="w_button_custom w_back w_left">
                    <input type="button" value="back" onclick="main.panels.slideBack();"/>
                </div>
                <span>wink airlines</span>
            </div>
            <div id="page1">
                <div>
                    <ul class="w_list w_border">
                        <li class="w_list_item w_border_bottom">
                            <a href="#" onclick="main.panels.slideTo('page2')">
                                presentation
                                <span class="w_icon w_chevron"></span>
                            </a>
                        </li>
                        <li class="w_list_item w_border_bottom">
                            <a href="#" onclick="main.panels.slideTo('page3')">
                                contact
                                <span class="w_icon w_chevron"></span>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
            <div id="page2">
                <!-- presentation content -->
            </div>
            <div id="page3">
                <!-- contact form -->
            </div>
        </div>
	</body>

and this is the javascript code modified from main.js

			init : function() {
				this.panels = new wink.plugins.AsyncPanels({
					duration : 500,
					pages : ['page1', {
						id : 'page2',
						url : './presentation.html'
					}, {
						id : 'page3',
						url : './contact.html'
					}]
				});

				var page2 = this.panels

                //document.getElementById("wrapper").appendChild(this.panels.getDomNode());
				document.body.appendChild(this.panels.getDomNode());

				wink.subscribe('/slidingpanels/events/slidestart', {
					context : this,
					method : 'toggleBackButtonDisplay',
					arguments : 'start'
				});
				wink.subscribe('/slidingpanels/events/slideend', {
					context : this,
					method : 'toggleBackButtonDisplay',
					arguments : 'end'
				});

				$('wrapper').style.width = window.innerWidth;

				scrollTo(0, 0, 0);
			},

I would like to know what is your advise on this….

  • This reply was modified 392 days ago by  keyclipse.
April 23, 2012 at 9:09 am #link

Hi,

Well, I would do something like this:

The HTML template:

<div id="wrapper" class="wrapper">
	<div id="options">
		options
		<li class="w_list_item w_border_bottom">
			<a href="#" onclick="main.closeOptions()">
				close options
				<span class="w_icon w_chevron"></span>
			</a>
		</li>
	</div>
	<div id="container">
		<div class="w_header_custom">
			<div id="back" class="w_button_custom w_back w_left">
				<input type="button" value="back" onclick="main.panels.slideBack();"/>
			</div>
			<span>wink airlines</span>
		</div>
		<div id="page1">
			<div>
				<ul class="w_list w_border">
					<li class="w_list_item w_border_bottom">
						<a href="#" onclick="main.panels.slideTo('page2')">
							presentation
							<span class="w_icon w_chevron"></span>
						</a>
					</li>
					<li class="w_list_item w_border_bottom">
						<a href="#" onclick="main.panels.slideTo('page3')">
							contact
							<span class="w_icon w_chevron"></span>
						</a>
					</li>
					<li class="w_list_item w_border_bottom">
						<a href="#" onclick="main.openOptions()">
							options
							<span class="w_icon w_chevron"></span>
						</a>
					</li>
				</ul>
			</div>
		</div>
		<div id="page2">
			<!-- presentation content -->
		</div>
		<div id="page3">
			<!-- contact form -->
		</div>
	</div>
</div>

the new styles:

#options
{
	position: relative;

	height: 100%;
	width: 100%;
}

#container
{
	position: absolute;

	left: 0;
	top: 0;

	background: #fff;

	height: 100%;
	width: 100%;
}

And the new JS code:

var main =
	{
		panels: null,

		init: function()
		{
			this.panels = new wink.plugins.AsyncPanels
			(
				{
					duration: 500,
					pages:
					[
					 	'page1',
					 	{id: 'page2', url: './presentation.html'},
					 	{id: 'page3', url: './contact.html'}
					 ]
				}
			);

			wink.byId('container').appendChild(this.panels.getDomNode());
			wink.fx.applyTransformTransition(wink.byId('container'), '400ms');

			wink.subscribe('/slidingpanels/events/slidestart', {context: this, method: 'toggleBackButtonDisplay', arguments: 'start'});
			wink.subscribe('/slidingpanels/events/slideend', {context: this, method: 'toggleBackButtonDisplay', arguments: 'end'});

			scrollTo(0, 0, 0);
		},

		openOptions: function()
		{
			wink.fx.applyTranslate(wink.byId('container'), window.innerWidth - 81, 0);
		},

		closeOptions: function()
		{
			wink.fx.applyTranslate(wink.byId('container'), 0, 0);
		},
...
}

Jérôme

  • This reply was modified 392 days ago by  admin.
April 23, 2012 at 9:14 am #link

It’s just a start, but I hope this will put you on the right track ;)

April 23, 2012 at 4:25 pm #link

Thanks Jerome,

This is a really great help. Just what i needed…

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.