Running jQuery Mobile on only a section of a page by id? - javascript

How to I apply jQuery Mobile only to a certain section of my page specified by element id?
Since it runs when the script is loaded, how do I limit it to only part of a page?

If I am not wrong then you want to apply css or style on certain div or another container.
Refer Below links.
StackOverflow And JQUERY MOBILE
I hope this both links will help you.

Related

Where should I place jQuery Mobile pages generated dynamically

Does anyone know the best place to add the HTML code for jQuery Mobile pages that have been dynamically generated?
I have been adding them to the end of the <body>, however, this is causing problems with other jQuery mobile pages.
I have tried adding the jQuery Mobile pages into a div at the end of the page, however, their ids are no longer accessible via hrefs.
Link to Code: http://jakeserver.com/Apps/BostonLandmarks/B11/index.html
Any ideas?
I recommend you move all script within the individual page divs to a global script tag and then run that code within a pagecreate event of the page e.g.:
$(document).on('pagecreate','#landmarks', function(){
function setNewActiveTab(newTab){
$(".LandmarksTab").removeClass("ui-btn-active");
$(".LandmarksTab").removeClass("ui-btn-active");
$(".MoreTab").removeClass("ui-btn-active");
$(newTab).addClass("ui-btn-active");
}
assembleRows(landmarksArray);
assembleLandmarkPages(landmarksArray);
determineMapScreen();
});
Here is a working jsFiddle based on your code.
This will ensure that the code runs at the correct time with respect to jQM's page creation/enhancement.

Dynamic Breadcrumbs using sections of page for hierarchy

Working on creating a dynamic breadcrumb plugin using either jQuery or Javascript, and I do not have the knowledge to make it change dynamically while you scroll the page.
So we have a fixed header element, that will house the navigation and breadcrumbs.
While scrolling down the page, I would like the breadcrumb navigation element to change based on what section I am scrolling past.
Is this possible?
I appreciate any help or suggestions.
I believe this is possible. You can use <name> or <id> tags similar to the way you want to direct someone to a certain part of a page.
I would use those to determine whether an element is in the viewport or outside of it.
If you are okay with using a plugin you should go with the JQuery isInViewport plugin :
https://plugins.jquery.com/isInViewport/
You can also take a look at the raw code and change it to your liking.

better ways to load views using jquery

OK. Let me try to explain my problem. I have three pages index, profile, contact and three links or navigation buttons in the header. When user clicks on profile button profile.html is loaded dynamically from the server using jquery load() method and place it in the div called container. Same goes for all pages. Now I also load all of my jquery plugins including jquery shadow plugin, script.js and jquery library on the index page only once. Now what I have is that on profile page I have a div tag on which I want to apply a jquery shadow plugin in my script.js which is loaded in index page. But it does not work this way(no idea why). What I have to do to make it work is to add a script tag in profile page and inside this I apply this shadow plugin to div tag which is inside profile page.
So this is what I want to ask is, Is there a better way to load pages through ajax using jquery so that whatever javascript code I am applying to all of the pages should be applied to all pages?
Thanks in advance

Smooth Transitions between div tags on click in CSS or Javascript in a single HTML Page

I have a problem in implementing smooth navigation between different div tags on a single page.
Say I have a page with 5 different tags and they have an anchor tag in them that will re-direct to some other div tag in the very same page. Now if I click on one anchor tag that is inside of a div tag, and it redirects to some other div tag in that same page, this effect will be very simple and without smoothness, just simple drop.
So I need this effect to be animated having some sort of a sliding effect.
Like this
In the above site, when you click on the "WHAT'S YOUR G'NOSH" tag, you slide down to the respective dig. I need this functionality and have tried moz-transition: ease 0.6s. and all that but haven't arrived at a solution yet, please help.
Regards.
G'NOSH are using the jQuery arctic_scroll plugin for internal links scrolls. You can find it and it's guide here.
Refer Animated scrollto effect. Hope it helps.
Its simmple man use this plugin: http://www.kryogenix.org/code/browser/smoothscroll/
Add the above plugin in the <head>
html for any link:
About me
Div to displayed on click of link:
<div id="about">I am UI/Ux designer born with a pair of headphone</div>
this is pure css solution but only for modern browsers
http://tympanus.net/codrops/2012/06/12/css-only-responsive-layout-with-smooth-transitions/

JScrollPane not working on site

I am trying to implement the JScrollPane plugin on my website. Having taken a look through numerous FAQ/tutorials for this and double checked my scripts but cannot see where something is going wrong.
All of the scripts are being correctly referenced, I am calling the latest version of the JQuery library and I have the CSS being called before the scripts.
The page I am trying to implement this on is:
http://theindiecinema.com/walking-backwards/99 (click on the rate button on the right side of the tv)
To see the scrolling box that the JScrollPane should be being applied I have set up a duplicate page but with the JScrollPane stuff removed:
http://theindiecinema.com/testing-nopane
Please can I get some advice of how I can get this working.
Much Appreciated
Francis
Call jScrollPane on .commentslist when it's revealed (by clicking Rate), not on $(document)ready. jScrollPane is having trouble initializing while the target element's parent is hidden. You should only have to do this once, but it won't really even matter if you re-call it every time you show #comments.
Alternately, you could un-hide #comments in your external CSS, then on document-ready, first initialize jScrollPane on .commentslist and then hide #comments.

Categories