Dynamic webpage sliding good scripting practice? - html

I want to script a website which will have a menu on the left side:
when clicked on an item on this menu the site slides up or down (but there should be no option to scroll up or down).
Yet now when the user interacts with something in the webpage (not the menu) the site slides right/left.
So there are no reloading of the site!
For example the menu contains home and account.
if the user is on home and clicks on acount the site slides down (but he should not have the option to scroll down by himself)!
Now on account when he clicks on a button named "Edit Account" the site slides (but not the menu) right to a page were he can edit his account no when he hits save the site slides back to account
With site I mean an inner pre defined box of course the header and footer don't move!
Here is a small example of a script I wrote on jsfiddle.
I know that this will look very cool but I don't want that the user to need to sacrifice website loading speed just for a cool sliding effect!
Now my question is: would this be good programming practice?

Right if i believe right you want something like my website "www.ohlookawebsite.com" what you will need to do is use jquery for .show and such to create the effect so for example
<div id="navagation">
<div id="home" onclick="homeClick()">Home</div>
<div id="about" onclick="aboutClick()">About</div>
<div id="account" onclick="accountClick()">Account</div>
</div>
That would be the navagation then you can set out the <div>s on the page with the ones that shouldn't be shown yet with style="display: none;" such as;
<div id="boxHome">
Welcome to the home page!
</div>
<div id="boxAbout" style="display: none;">
Welcome To the About Page!
</div>
<div id="boxAccount" style="display: none;>
You're account info!
</div>
You will need to the use jquery and javascript to show different "Pages"
function homeClick(){
$("#boxAbout").fadeOut(500);
$("#boxAccount").fadeOut(500);
$("#home").css("color", "green");
$("#boxHome").delay(500).fadeIn(1000);
}
You can see an example of this here: http://jsfiddle.net/gM4hB/4/
Hope this helps

Related

Highlighting the current page link

I have built this website so far in Wordpress.
I created the navigation links on the left manually by entering this code in the Wordpress Left Sidebar widget:
<ul>
<li><h5><a class="page page-id-35 page-template-default logged-in admin-bar no-customize-support tc-fade-hover-links tc-l-sidebar tc-sticky-header sticky-disabled tc-transparent-on-scroll no-navbar skin-green tc-side-menu tc-sticky-footer sn-right" href="?page_id=35/" >This is page 1</a></h5></li>
<li><h5><a class="page page-id-39 page-template-default logged-in admin-bar no-customize-support tc-fade-hover-links tc-l-sidebar tc-sticky-header sticky-disabled tc-transparent-on-scroll no-navbar skin-green tc-side-menu tc-sticky-footer sn-right" href="?page_id=39/">This is page 2</a></h5></li>
</ul>
The long class names that you see there I got them by looking at the source code for each of the two pages.
Then, in the CSS stylesheet, I added this:
.page.page-id-35.page-template-default.logged-in.admin-bar.no-customize-support.tc-fade-hover-links.tc-l-sidebar.tc-sticky-header.sticky-disabled.tc-transparent-on-scroll.no-navbar.skin-green.tc-side-menu.tc-sticky-footer.sn-right a.page.page-id-35.page-template-default.logged-in.admin-bar.no-customize-support.tc-fade-hover-links.tc-l-sidebar.tc-sticky-header.sticky-disabled.tc-transparent-on-scroll.no-navbar.skin-green.tc-side-menu.tc-sticky-footer.sn-right,
.page.page-id-39.page-template-default.logged-in.admin-bar.no-customize-support.tc-fade-hover-links.tc-l-sidebar.tc-sticky-header.sticky-disabled.tc-transparent-on-scroll.no-navbar.skin-green.tc-side-menu.tc-sticky-footer.sn-right a.page.page-id-39.page-template-default.logged-in.admin-bar.no-customize-support.tc-fade-hover-links.tc-l-sidebar.tc-sticky-header.sticky-disabled.tc-transparent-on-scroll.no-navbar.skin-green.tc-side-menu.tc-sticky-footer.sn-right
{
background:red;
color:white;
}
I was expecting the links on the left to be highlighted when their corresponding page was loaded on the browser. The pages load fine, but there is no highlighting. Anyone knows what I am doing wrong? Or is there any other technique to highlight the navigation menu for the current page?

common image on page with tab bar contents of onsen UI

I am trying to implement a page with tab bar in onsen UI. Where I am able to switch pages between "Tab1" and "Tab2".
But my question is how can I place the Image which will be present in both tab bar pages and only remaining part of the page will switch.
For Example as given in wire frame, "common image content" should be present when user clicks any of the tab, only content "tab1 content" and "tab2 content" are gets changed.
Please let me know any work around for this ?
Thanks in Advance...
You could place a toolbar on top of your tabbar. It is persistent, you can make it transparent and you can put an image into it.
Example from the Docs:
<ons-page>
<ons-toolbar>
<div class="center">Page Title</div>
</ons-toolbar>
<ons-tabbar position="top">
<ons-tab page="page1.html" icon="fa-square"></ons-tab>
<ons-tab page="page2.html" icon="fa-square"></ons-tab>
<ons-tab page="page3.html" icon="fa-square"></ons-tab>
</ons-tabbar>
</ons-page>

How to handle multiple nav panel menus using jquery mobile?

jquery mobile newbie -- I inherited this project.
I have quite a few 'pages' in my jquery mobile app. On each page I have a nav panel. Each page is set up much like this:
<div data-role="page" id="help_manual" data-theme="d">
<div data-role="panel" id="navpanel_help_manual" data-theme="d" data-display="overlay" data-position="right">
<div data-role="controlgroup" data-corners="false">
Home
User main menu
</div>
</div>
<div data-role="header" data-position="fixed" data-tap-toggle="false">
<a data-icon="bars" class="ui-btn-right" style="margin-top:10px;" href="#navpanel_help_manual"
data-iconpos="notext">Menu</a> <!-- this is the button that actually brings up the above panel-->
<h3>User Manual</h3>
</div>
<div data-role="content">
BLAH BLAH CONTENT
</div>
<div data-role="footer" data-position="fixed" data-tap-toggle="false">
Back to main menu
</div>
</div>
This all works well and good.
Then you make another page. ... Then another... Then another... Suddenly you've got a few dozen pages all with their own 'menus'. They all work, but there is a LOT of redundant code, given all the menus are identical.
Now I want to make a change to all of the menus.... and instead of modifying one 'navigation panel' I have to make the change a few dozen error-prone times.
I have tried simply taking the 'panel' code and moving it outside the 'page' div... but that results in, effectively, a 'new' 'page' when the button is clicked. Other attempts at moving the various parts of this code around are similarly broken.
An include could remove the 'list' from the 'core' of the control group... unfortunately, that still leaves a lot of redundant code and I've got one fun tweak: This page needs to be able to work offline. The purpose of this app is to be able to go offline, collect data 'in the field', and come back and upload it. So a SSI isn't an good option.
Help?
Here is a JsFiddle with multiple pages and the panel written only once.
You should write your panel once outside the page. (If you have one file per page, just write the panel outside the index page as a sibling of the page) :
<div data-role="panel" id="navpanel_help_manual" data-theme="d" data-display="overlay" data-position="right">
...
</div>
<div data-role="page" id="help_manual" data-theme="d">
...
</div>
Doing so and as it becomes an external panel. You should then initialise it manually.
$('#navpanel_help_manual').panel();
The panels below are all located outside the page. Panels outside of a page must be initalized manually and will not be handled by auto init. Panels outside of pages will remain in the DOM (unless manually removed) as long as you use Ajax navigation, and can be opened or closed from any page.

How to set each type of page transition to a specific page? (css animations)

So I have 4 different room transitions (up, down, left & right). I want to be able to set each transition to go to a specific page, and repeat if the same transition is clicked again.
For example, have "left" (data-animation 55) goto "Page1.html", and if I was already on "Page1.html", then it would just transition right back into the page. And I would have the "right" button, go to "Page2.html", etc.
https://github.com/cweigen/page_transition_room
There's the github repo, but this is the code that I've been messing with, experimenting with different versions of it to attempt going to a specific page and repeating if the same button is clicked, but go to another specific page is another menu button is clicked.
<div class="pt-triggers">
<div id="dl-menu" >
<ul class="dl-menu">
<li data-animation="54"><a href="#" > right </a></li>
<div class="pt-triggers1">
<li data-animation="55"><a href="#" > left</a></li>
<div class="pt-triggers2">
<li data-animation="56"><a href="#" > down</a></li>
<div class="pt-triggers3">
<li data-animation="57"><a href="#" > up</a></li></div>
</ul>
</div>
</div>
<div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1"><iframe src="http://visiondigit.al/VisionDigital_Launch/" width="100%" height="100%"> </iframe></div>
<div class="pt-page pt-page-2"><iframe src="http://scsuchat.com" width="100%" height="100%"> </iframe></div>
</div>
You can't expect others to download the repo and build it for you. Time matters! That's the first thing you need to learn how to ask a question properly on StackOverflow.
As you are a new user, I'm going to make one-off excuse for you.
The library you are using is not the best choice for your task. However, it does provide as many as 67 different transition effects, which are defined in **pagetransions.js** and called using data-animation attribute. Have a look at the js file and you can choose the specific animation you are looking for.
To solve your other problem, you'll have to write a bit of your own code as the author doesn't provide a function to link each button with specific page, nor hiding the button when you are already on that page. You can use jQuery to do so.
But like I said, this is not the best nor the only option you have.
Check
THIS DEMO
I have created a structure that mostly mimics your requirements. Have a play and try to understand the demo. The structure is quite simple. It uses two external resources which you can see and download from the fiddle.

html navigation page-jump

I am creating a website with navigation that causes a page-jump. But when the page-jump event is executed my page will not load properly, and most content above the called is not loaded. Here is a copy of my navigation:
<div id="navbar-type">
<ul>
<li>BEAR SOUP</li>
<li>FIAT MOTORS</li>
<li>NEWSEUM</li>
<li>TEXAS PARKS</li>
<li>ZACH THEATRE</li>
<li>GUINNESS</li>
</ul>
</div>
How can I fix the code so that the items above the page-jump are visible?
Thanks
you just need to put <a name="bear-logo"> where you want the page to scroll to when the user clicks the link and the same for the others. For example, if you wanted to scroll to the <p> tag below, you could do it like this:
BEAR SOUP
<!--More Code-->
<a name="bear-logo">
<p>Bear Soup:</p>
There doesn't seem to be any error in the displayed HTML. However, you shouldn't need to include the target for inline page anchors.
I assume you actually have the links on the page. For example, <a id="bear-logo"></a>, <a id="fiat-logo"></a>, and so on.
Moreover, the issue you describe seems to indicate that there is some invalid code elsewhere on the page (perhaps JS or jQuery). I'd recommend commenting out sections of your HTML until you isolate the interfering culprit.
BTW, have you considering using a simple jQuery script to flow the navigation to the logos instead of just abruptly jumping to them?