When I include the js for lightbox it prevents my other js from running; which means my jquery nav and slide down effects for divs stop working. Am I including the files in the correctly? I tried the endconflict() in the top of my script but that didn't work. Any help is greatly appreciated.
Thx
<link rel="stylesheet" type="text/css" href="jquery-lightbox-0.5/css/jquery.lightbox-0.5.css" media="screen" /> <link rel="stylesheet" href="css/bootstrap.css" type="text/css">
<link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css">
<link rel="stylesheet" href="css/style.css" type="text/css">
***<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />***
<script type="text/javascript" src="js/jquery.js"></script>
<script src="javascript/jquery-1.7.1.min.js"></script>
<script src="javascript/bootstrap.js"></script>
***<script type="text/javascript" src="../lightbox2.05/js/prototype.js"></script>
<script type="text/javascript" src="../lightbox2.05/js/scriptaculous.js"></script>
<script type="text/javascript" src="../lightbox2.05/js/lightbox.js"></script>***
<script>
<a href="images/Screen Shot 2012-02-27 at 9.51.49 PM.png" rel="lightbox">
<img src="../../images/Screen Shot 2012-02-27 at 9.56.49 PM.png" height="180" width="460" alt="">
</a>
The problem is that lighbox uses pieces of Scriptaculous and Prototype, which are other javascript libraries like jQuery is. They don't play nicely with each, so you have to tell jQuery to avoid them.
Rather than the typical document ready setup that you normally put your jQuery code in:
$(document).ready(function() {
// Stuff to do as soon as the DOM is ready;
});
You will instead wrap your jQuery code in this:
jQuery(document).ready(function($){
// Stuff to do as soon as the DOM is ready;
});
You can read more about handling javascript library conflicts here: http://docs.jquery.com/Using_jQuery_with_Other_Libraries
Related
I want to implement a date picker in one of my text input page. I have a page call panel.blade.php and app.blade.php which is the layout page. Since Laravel comes with bootstrap and jquery installed, I did the usual import to include the necessary files to make it work.Below is the code.
app.blade.php:
<head>
<style>
html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
</style>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="{{ asset('js/app.js') }}"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
</head>
.
.
.
.
.
.
<script>
$('.date').datepicker({
format: 'mm-dd-yyyy'
});
</script>
panel.blade.php:
<tr>
<td>454542</td>
<td><input class="date form-control" type="text"></td>
<td>Chair</td>
<td>Received</td>
<td>xxxx</td>
</tr>
The problem is when I click on the textbox, it's supposed to pop out the date picker UI but nothing came out. I spent some time trying to figure out what went wrong but to no avail. Anyone can point out what went wrong?
Appreciate it.
The problem is that you are assuming that Laravel includes Bootstrap and jquery, but I don't see it in a fresh install. (Are you using a template maybe?)
Put this lines in your head:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
And it should works perfectly ;)
EDIT:
Try putting the jquery import before the bootstrap datepicker import:
app.blade.php
<style>
html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
</style>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="{{ asset('js/app.js') }}"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
</head>
EDIT2:
To change the format you can also try to add a property to the input field:
<input class="date form-control" data-date-format="mm/dd/yyyy">
Hope it works flawlessly!
I was looking at the documentation for the insertSheet method for Kendo Spreadsheet, at the below link:
http://docs.telerik.com/kendo-ui/api/javascript/ui/spreadsheet#methods-insertSheet
I didn't see any examples on how to actually use this method. I tried searching on Kendo forums but didn't have any luck. Has anyone used this method or seen any examples of usage that we can use as a reference?
Thanks in advance.
I have provided a very simple dojo showing how to insert a sheet and then rename it.
https://dojo.telerik.com/AXulOsAS
If you look at the demo's for the spreadsheet control it gives you some insight into the control but this is still a relatively new element to the kendo UI suite so the documentation is a little sparse.
https://demos.telerik.com/kendo-ui/spreadsheet/index
have added the dojo code here just in case:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.mobile.all.min.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.1.115/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.1.115/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.1.115/js/kendo.all.min.js"></script></head>
<body>
<div id="ss">
</div>
<script>
$('document').ready(function(){
$('#ss').kendoSpreadsheet();
var ss = $('#ss').data('kendoSpreadsheet');
ss.insertSheet();
ss.renameSheet(ss.sheets()[1], 'test 1');
});
</script>
</body>
</html>
I am developing an asp.net mvc application and I use this template for my app. For js and css resources, I use URL.Content helper method, but the problem is that css resources referenced by template loads only in home/index action and when I go to other action, browser consoles says that it cant find the resources.
Here is what I have in my _layout.cshtml:
<script src="#Url.Content("~/Scripts/jquery-1.8.3.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/js/config.js")"></script>
<script src="#Url.Content("~/js/skel.min.js")"></script>
<script src="#Url.Content("~/js/skel-panels.min.js")"></script>
<script src="#Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<noscript>
<link rel="stylesheet" href="#Url.Content("~/css/skel-noscript.css")"/>
<link rel="stylesheet" href="#Url.Content("~/css/style.css")" />
<link rel="stylesheet" href="#Url.Content("~/css/style-desktop.css")" />
</noscript>
Here is what I can see in chrome Element tab:
<script src="/Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="/js/config.js"></script>
<script src="/js/skel.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/style-desktop.css">
<script src="/js/skel-panels.min.js"></script>
<style type="text/css"></style>
<script src="/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<noscript>
<link rel="stylesheet" href="/css/skel-noscript.css"/>
<link rel="stylesheet" href="/css/style.css" />
<link rel="stylesheet" href="/css/style-desktop.css" />
</noscript>
And here is the error I got from console in broswer:
GET http:///myapp/test/css/style-desktop.css 404 (Not Found) skel.min.js:1
GET http://myapp/test/css/style.css 404 (Not Found) skel.min.js:1
All you have to do is set the "prefix" in "_skel_config" obj. to the right path of your styles.
window._skel_config = {
prefix: 'css/style',
};
Alaasdk is right, most of similar templates using skelJS come with something like this:
window._skel_config = {
prefix: '/css/style'
}
in their js/config.js file. So if you have controllers that handle URLs like this:
domain/users/10
domain/category/subcategory/article-slug
or similar, you only set it to relative URL like
prefix: '/css/style'
The stylesheet links you have in your snippet are in a <noscript> block and only apply to users who have javascript turned off.
As #marcus33cz and #alaasdk point out, you set the relative path in config.js.
In the latest version of skel, you set it in init.js like this:
global: { href: '/css/style.css', containers: 1400, grid: { gutters: ['2em', 0] } },
desktop: { media: '(max-width: 1680px)', href: '/css/style-desktop.css', containers: 1200 },
// and so on for all of your stylesheets
I am very new in Codeigniter...i have some basic ideas..but not sufficient.lets talk about the problem....
I have a static website..which will be dynamic soon.Now this static website contains css,css3 in a css forlder, javascript in javascript folder,image in images folder.Now i am wanting to set this static website into codeigniter.I copy paste the whole codes including index.php and other pages and the folders(css,javascript.images)into the view folder of codeigniter.for all of your kind information my index.php page is just like that...
<!DOCTYPE html>
<html lang="en">
<head>
<title>Home</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/slider.css">
<!--<link href='http://fonts.googleapis.com/css?family=Great+Vibes'
rel='stylesheet' type='text/css'>-->
<script src="<?= base_url() ?>path/images/js/jquery-1.7.min.js"></script>
<script src="<?= base_url() ?>path/images/js/jquery.easing.1.3.js"></script>
<script src="<?= base_url() ?>path/images/js/tms-0.4.1.js"></script>
<script src="<?= base_url() ?>path/images/js/vpb_script.js"></script>
<script src="<?= base_url() ?>path/images/js/pop.js"></script>
<!--start popup window ref-->
<link href="css/colorbox.css" rel="stylesheet" type="text/css" media="all" />
<script src="<?= base_url() ?>path/js/jquery_002.js"></script>
<script>
$(document).ready(function(){
$(".image_show").colorbox({rel:'image_show', transition:"fade"});
});
</script>
<!--end popup window ref-->
<script>
$(document).ready(function(){
$('.slider')._TMS({
show:0,
pauseOnHover:true,
prevBu:false,
nextBu:false,
playBu:false,
duration:700,
preset:'fade',
pagination:true,
pagNums:false,
slideshow:8000,
numStatus:false,
banners:false,
waitBannerAnimation:false,
progressBar:false
})
});
</script>
<style type='text/css'>
/*This will work for chrome */
#vpb_general_button{
padding:5px 2px 4px 2px;
}
/*This will work for firefox*/
#-moz-document url-prefix() {
#vpb_general_button{
padding:5px 2px 6px 2px;
}
}
</style>
<!--[if lt IE 8]>
<div style=' clear: both; text-align:center; position: relative;'>
<a href="http://windows.microsoft.com/en-US/
internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
<img src="http://storage.ie6countdown.com/assets/100/
images/banners/warning_bar_0000_us.jpg" border="0"
height="42" width="820" alt="You are using an outdated browser. For a faster,
safer browsing experience, upgrade for free today." />
</a>
</div>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/ie.css">
<![endif]-->
</head>
<body>
<!--<div class="bg-top">-->
<div class="bgr">
<!--==============================Wrapper=================================-->
<div class="wrapper">
<?php
include_once('header.php');
include_once('navigation.php');
include_once('slider.php');
include_once('offers.php');
include_once('invite.php');
include_once('testimonial.php');
include_once('special_item.php');
include_once('footer.php');
include_once('popup.php');
?>
and my conroller is like that...
<?php
class Site extends CI_Controller
{
function home()
{
$this->load->view('index');
}
}
?>
the problem is that my webpage is loading but without the design,may b its not finding the javascript or css
i know i am making a mistake here..bur i can't fix it out,please help me to fix it out..
usually we put all files like that into an "assets" folder in the application root, and then make sure to use an Asset_Helper to point to those files. This is what CodeIgniter suggests
The folders (css, javascript, images) should NOT be pasted into the views folder, but in the folder where your Code Igniter's index.php is. (Usually, the parent folder of the application folder, i.e., your site public root.)
You can add <?= base_url() ?> to all your css link.
<link rel="stylesheet" type="text/css" media="screen"
href="<?= base_url() ?>path/to/css/reset.css">
There is a more comprehensive answer here. You may want to consider permissions issues that could be going on as a result of placing your css dir within the application/views dir.
Create an assets dir outside the application dir and use the URL helper by loading it into your controller like this.
Im trying to use ScrollTo and Lightbox2 on the same page but the Lightbox2 JS links knock out the ScrollTo JS files.
This is what I have:
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/lightbox.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://flesler-plugins.googlecode.com/files/jquery.localscroll-1.2.7-min.js"></script>
<script type="text/javascript" src="http://flesler-plugins.googlecode.com/files/jquery.scrollTo-1.4.2-min.js"></script>
<script type="text/javascript" src="js/transition.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#links').localScroll({
target:'body'
});
});
<script type="text/javascript" src="js/transition.js"></script>
Where am I going wrong?
Hope someone can help!
Kind Regards
Matt
<script type="text/javascript"> $(document).ready(function() {
$('#links').localScroll({
target:'body'
});
});
I think you have a typo? You need to end this script with </script>