My site loads 4 different pages/html's into a container html. On one of the pages "Pappír" I have a video which I control with clicks on different a href's. The problem is that when I reopen the page everything seems to happen twice. When I reopen the page the third time, yes, everything happens 3 times ; } If you look at the page you'll notice this on the Close button symbol.
I guess the page is adding a new video on top of the older one every time it is opened. Is there a way to unload a video when leaving a page?
1) I load a html page (let's call it subPage) into a div on the parent page via a link on the parent page
2) the loaded subPage calles a function in the parent page (window.parent.Func1(e);)
Here comes the problem :
3) Func1(e) works fine when the function resides in the main HTML code within a <script> tag of the parent document BUT when I move this function into a linked (linked to parent page) javascript/jquery document and place it within the document.ready script it does NOT work anymore.
Can you suggest any work-around? (It does work if I remove the document.ready but I need that stopper because of other issues).
Best regards,
Karl
p.s. It's freeeeezing in Iceland these days and my brain is probably in a similar condition. Therefore I would appreciate a solution to this problem.
I have since downloaded an example of Ben Alman's BBQ "basic hashchange". It works as expected, but I am having trouble integrating it with my project (so what else is new?).
I've stripped the example-code down a little (see code below) and think I have grasped the basic idea.
To clarify my problem : I need to manipulate several other elements on the main-page (index-page), for example to change the content of a div (let's say #backgroundPict) each time an AJAX call is made (either from scratch or from cache).
So the question is : Whereabouts in the example-code can I experiment with this? I've tried justabout everywhere!
Example code:
$(document).ready(function() {
$(function (){
// Keep a mapping of url-to-container for caching purposes.
var cache = {
// If url is '' (no fragment), display this div's content.
'': $('.bbq-default')
};
// Bind an event to window.onhashchange that, when the history state changes,
// gets the url from the hash and displays either our cached content or fetches
// new content to be displayed.
$(window).bind( 'hashchange', function(e) {
// Get the hash (fragment) as a string, with any leading # removed. Note that
// in jQuery 1.4, you should use e.fragment instead of $.param.fragment().
var url = $.param.fragment();
// Remove .bbq-current class from any previously "current" link(s).
Earlier today I posted a question concerning this. I found a solution which work cross-platform. I had previously put the cookie script into a script tag on the page and the jquery post function in an external javascript document. By joining the two into an external script things worked.
The code :
$(document).ready(function() {
function getDocument() {
var _query = 1;
var _category = $.cookie("whichCategory");
if (_category.length > 0) {
_query = _category;
} else {
_query = 1;
} // the following if statement is used to hinder jquery post to run before the above script ;(
Hi. I'm using Klaus Hartl's "jQuery Cookie plugin" to send variables between pages with Jquery. Works like a smile in Chrome BUT messes everything up (reloads the whole page into a one of it's div's) in FireFox and (of course) IE... Any clues. Can this be accomplished without using cookies?
I'm loading a (HTML) list from mySql via PHP into a main page using load. The main page is linked to a css file and a js file (jquery). The loaded data assigns the css file BUT does not seem to be able to find the js file as the click handlers in that file do not work. I'm new at this and this is probably a BASIC issue. Help!
I'm loading a (html) list from mySql via php using load into my main page. The main page is linked to a js file and a css file. The loaded data assigns the css file correctly BUT does not seem to be able to find the js file as click handlers in that file do not work. This is probably a very BASIC issue... Help!