Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:29:36+00:00 2026-06-04T19:29:36+00:00

I have multiple html documents that share one css stylesheet (not multiple page div

  • 0

I have multiple html documents that share one css stylesheet (not multiple page div sections in one html) for web app project using jQuery mobile framework.
All html documents work fine individually but if one page opens from another page’s link, all the script and styles do not apply anymore. Is there any way to keep each html page refreshed whenever they are linked? I have tried data-ajax="false" and rel="external" in <a> tags, but they did not work. Your help will be appreciated!

yes, each html has plugins links in the head tags:

<link rel="stylesheet" href="style/custom.css"> 
<link rel="stylesheet" href="style/jquery.mobile-1.0.1.min.css" /> 
<script src="js/jquery-1.6.4.min.js"></script> 
<script src="js/jquery.mobile-1.0.1.min.js"></script> 
<script type="text/javascript">
 $(document).ready(function(event){ 
//custom script in each html 
}); 

And htmls are linked with tags in their tags:

<a href="page1.html">page 1</a> 
<a href="page2.html">page 2</a> 
<a href="page3.html">page 3</a>

The links work but custom stylesheet and script are not applied anymore when a new html opens from previous page. If I add data-ajax=”false” or rel=”external” in the tags, even the links do not work anymore.

Thanks for looking into the code!

PS. Sorry that I am not familiar with jsfiddle and copied my code for two separate html files. If I open page2.html first, the slider works fine. But if I open it from the menu in page1.html, the slider does not work.

This is page1.html:

<!doctype html> 
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(event){
    $(document).toggle(
      function(){
      $('.navigation').css("display", "block");},
      function(){
      $('.navigation').css("display", "none");
      });
});
</script>
<style type="text/css">
.navigation{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:40px;
    background:#cfcfcf;
    display:none;
}
.menu{
    float:left;
    margin: 10px 20px;
    text-decoration:none;
}
.main{
    margin: 50px;
}
</style>
<body>
<div data-role="page">
    <div id="page1">
        <div class="navigation">
            <a class="menu" href="page1.html">page 1</a> 
            <a class="menu" href="page2.html">page 2</a> 
        </div>
        <p class="main"> this is page1 <br> click anywhere</p>
    </div>
</div>
</body>
</html>

This is page2.html:

<!doctype html> 
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(event){
    $(document).toggle(
      function(){
      $('.navigation').css("display", "block");},
      function(){
      $('.navigation').css("display", "none");
      });

    $('.slider').change(function(){
        var wid= $(this).val() + "px";
        $('#box').css("width", wid);
    });  
});
</script>
<style type="text/css">
.navigation{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:40px;
    background:#cfcfcf;
    display:none;
}
.menu{
    float:left;
    margin: 10px 20px;
    text-decoration:none;
}
.main{
    margin: 50px;
}

#box{
    width:10px;
    height:30px;
    margin: 0px 50px;
    background:#000;
}

</style>
<body>
<div data-role="page">
    <div id="page2">
        <div class="navigation">
            <a class="menu" href="page1.html">page 1</a> 
            <a class="menu" href="page2.html">page 2</a> 
        </div>
        <p class="main"> this is page2 <br>adjust box width with slider </p>
        <div id="box"></div>
        <input type="range" class="slider" min="5" max="600" step="1" value="10"/> 
    </div>
</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:29:37+00:00Added an answer on June 4, 2026 at 7:29 pm

    put your css and scripts to each page head tag


    try this one

     <!doctype html> 
    <html>
    <head>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
    
    <script type="text/javascript">
    
    
    
    $( document ).delegate("#page1", "pageinit", function() {     
    
        $(document).toggle(
          function(){
          $('.navigation').css("display", "block");},
          function(){
          $('.navigation').css("display", "none");
          });                 
    });
    
    </script>
    <style type="text/css">
    .navigation{
        position:fixed;
        top:0;
        left:0;
        width:100%;
        height:40px;
        background:#cfcfcf;
        display:none;
    }
    .menu{
        float:left;
        margin: 10px 20px;
        text-decoration:none;
    }
    .main{
        margin: 50px;
    }
    </style>
    <body>
    <div data-role="page" id="page1">
        <div>
            <div class="navigation">
                <a class="menu" href="page1.html">page 1</a> 
                <a class="menu" href="page2.html">page 2</a> 
            </div>
            <p class="main"> this is page1 <br> click anywhere</p>
        </div>
    </div>
    
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
    </body>
    </html>
    

    And page2.html ,

     <!doctype html> 
    <html>
    <head>   
    
    <body>
    
    
    <div data-role="page" id="page2">
    
     <script type="text/javascript">
    
    
    $( document ).delegate("#page2", "pageinit", function() { 
        $(document).toggle(
          function(){
          $('.navigation').css("display", "block");},
          function(){
          $('.navigation').css("display", "none");
          });
    
        $('.slider').change(function(){
            var wid= $(this).val() + "px";
            $('#box').css("width", wid);
        });  
    });
    </script>
    <style type="text/css">
    .navigation{
        position:fixed;
        top:0;
        left:0;
        width:100%;
        height:40px;
        background:#cfcfcf;
        display:none;
    }
    .menu{
        float:left;
        margin: 10px 20px;
        text-decoration:none;
    }
    .main{
        margin: 50px;
    }
    
    #box{
        width:10px;
        height:30px;
        margin: 0px 50px;
        background:#000;
    }
    
    </style>
        <div >
            <div class="navigation">
                <a class="menu" href="page1.html">page 1</a> 
                <a class="menu" href="page2.html">page 2</a> 
            </div>
            <p class="main"> this is page2 <br>adjust box width with slider </p>
            <div id="box"></div>
            <input type="range" class="slider" min="5" max="600" step="1" value="10"/> 
        </div>
    </div>
    </body>
    </html>
    

    try this one

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple javascript functions in my html page. One of them, by far
I have a messy html that looks like this: <div id=:0.page.0 class=page-element style=width: 1620px;>
So i have a page that is gonna have multiple modal popups. Each one
Working on an AJAX website (HTML,CSS,JavaScript, AJAX, PHP, MySQL). I have multiple javascript functions
I have this HTML code multiple times one after the other: <li> <img src=path/to/my/picture.jpg
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I need a html document, that contains multiple div's with 100% height (screen filling)
I have a UserControl that I want to include in a page multiple times
In a large HTML document, I have multiple lines that look like this. The
I have a .zip file that contains sub-directories with html,png, and css files in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.