My javascript code for slider is as follows which is displayed in the
html format but not displayed when I integrated it into a theme.This code is in header.php.I have called all the requred js css and image files in it and that worked fine but the problem is in slider portion.
Code in header.php
<script type="text/javascript">
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide",
useCSS: Modernizr.touch
});
});
</script>
Code in index.php
<div class="flexslider">
<ul class="slides">
<li>
<div class="hero-unit">
<h1>Affordable Hosting Solution</h1>
<h3>Flathost is a bootstrap based responsive minimal, flat and afforable
hosting template with easy customization and great support</h3>
<div class="slider-actions text-center"> <a href="features.html" class="btn
btn-success btn-lg">Explore Features </a> <a href="pricing.html" class="btn
btn-primary btn-lg">Plans and Pricing </a> </div>
</div>
</li>
<li>
<div class="slide2">
<p><img src="<?php echo get_template_directory_uri(); ?
>/images/server1.png" alt="server" class="img-responsive center-block"></p>
<h1>Dedicated and VIP Hosting</h1>
</div>
</li>
<li>
<div class="slide3">
<p class="pull-left"><img src="<?php echo get_template_directory_uri(); ?
>/images/server2.png" alt="server" class="img-responsive"></p>
<h1>Managed Hosting</h1>
<h3>Flathost is a bootstrap based responsive minimal, flat and afforable
hosting template with easy customization and great support </h3>
</div>
</li>
</ul>
</div>
</div>
</div>
<?php echo do_shortcode('[thethe-image-slider name="flexslider"]'); ?>
Related
I want to redirect the user to a particular section of an html page.
// javascript for owl
$(document).ready(function(){
$('.owl-two').owlCarousel({
loop:true,
margin:10,
nav:true,
autoplay:true,
responsive:{
0:{
items:1
},
600:{
items:2
},
1000:{
items:3
}
}
});
});
<!-- nav-->
<ul class="dropdown-menu">
<li>Hair</li>
<li>Nail</li>
<li>Wax</li>
</ul>
<!-- owl carousel in salon services page-->
<div id="nail" class="row" >
<br>
<br>
<h3 class="text-center">Our Nail Services</h3>
<br>
<!-- nail carousal-->
<div class="owl-two owl-carousel owl-theme">
<div class="item"><img src="images/n1.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Manicure</h4>
</div>
<div class="item"><img src="images/n2.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Pedicure</h4>
</div>
<div class="item"><img src="images/n3.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Nail Painting and Design</h4>
</div>
<div class="item"><img src="images/n4.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Nail Extensions</h4>
</div>
</div>
I want to redirect the user directly from nav dropdown to another page's div containing that content. The page to which I want to redirect has 3 owl carousels.
I have already tried the html id redirect. <a href="#id">, but it does not works completely. The page redirects briefly to the section but scrolls automatically to the top of the page.
I am using the owl carousel and think that owl javascript is the responsible factor for this as I have tested it with removing owl and it works, also the id redirect works fine when done from the same page (i.e.services page ).
I have 3 carousels 1.hair 2.nail 3.wax
Kindly help I want to keep owl and the section redirect function. Thanks.
.sec {
width: 100%;
height: 100vh;
background-color: #ccc;
margin-bottom: 12px;
}
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
</ul>
<div id="one" class="sec">
<h1>One</h1>
</div>
<div id="two" class="sec">
<h1>Two</h1>
</div>
<div id="three" class="sec">
<h1>Three</h1>
</div>
<div id="four" class="sec">
<h1>Four</h1>
</div>
i have pasted some two screen shoots of my database and how actually i want my web page to look. im trying to get this done but not getting how to solve the issue
i have stored all the images in folder and also the image path in the database, now i want to fetch the image in such a way that when i click the all works it should display all the images but when i click creative or photography or web development like this then it should show only those images which are related to their classes stored in database with type as column. alternatively for example if i click say creative then it should display 2nd, 3rd, 5th and 8th like this.i really don have any idea how to do this. please i really need help
//-----controller------
public function portfolio()
{
$this->load->helper('url');
$this->load->view('header');
$data['results'] = $this->Contact_model->getAllRecords3();
$this->load->view('portfolio',$data);
$this->load->view('footer');
}
//--------model-----
function getAllRecords3()
{
return $this->db->get('portfolio1')->result();
}
//-------view---------
<section id="portfolio">
<div class="container">
<div class="center">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt</p>
</div>
<ul class="portfolio-filter text-center">
<li><a class="btn btn-default active" href="#" data-filter="*">All Works</a></li>
<li><a class="btn btn-default" href="#" data-filter=".bootstrap">Creative</a></li>
<li><a class="btn btn-default" href="#" data-filter=".html">Photography</a></li>
<li><a class="btn btn-default" href="#" data-filter=".wordpress">Web Development</a></li>
</ul>
<!--/#portfolio-filter-->
</div>
<div class="container">
<div class="">
<div class="portfolio-items">
<?php
if( !empty($results) ) {
foreach($results as $row) {?>
<div class="portfolio-item apps joomla col-xs-12 col-sm-4 col-md-3">
<div class="recent-work-wrap">
<img class="img-responsive" src="<?php echo base_url('uploads/'.$row->filename);?>" alt="">
<div class="overlay">
<div class="recent-work-inner">
<h3><?php echo $row->first_content; ?></h3>
<p><?php echo $row->second_content; ?></p>
<a class="preview" href="<?php echo base_url('uploads/'.$row->filename);?>" rel="prettyPhoto"><i class="fa fa-eye"></i> View</a>
</div>
</div>
</div>
</div>
<?php
} ?>
<?php }
?>
</div>
</div>
</div>
</section>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="<?php echo base_url(); ?>js/jquery-2.1.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<?php echo base_url(); ?>js/bootstrap.min.js"></script>
<script src="<?php echo base_url(); ?>js/jquery.prettyPhoto.js"></script>
<script src="<?php echo base_url(); ?>js/jquery.isotope.min.js"></script>
<script src="<?php echo base_url(); ?>js/wow.min.js"></script>
<script src="<?php echo base_url(); ?>js/functions.js"></script>
Please try below solution.
You have missed dynamic classes adding in div like apps and joomla
<div class="portfolio-item apps joomla col-xs-12 col-sm-4 col-md-3">
added class in above line with your existing code
<?php
foreach($results as $row) {
//code for getting dynamic class names from db
$class = explode(",.", $row->type);
$gettypes = implode(" ", $class);
?>
<div class="portfolio-item <?php echo $gettypes;?> col-xs-12 col-sm-4 col-md-3">
Hope this work!
U have included jquery.isotope.min.js library u need to follow following documentation
https://isotope.metafizzy.co/
$grid.isotope({ filter: '.transition' })
also change to following view code
<div class="portfolio-item <?php echo $gettypes;?> col-xs-12 col-sm-4 col-md-3">
Let me just give you a brief introduction to the question, I'm going to be having about 20 pages on my website once a user logs in, I need to organise these pages to use the same header, so I've come to the decision to use a layout as I'm using Laravel framework, it seemed stupid to have the same header spread across the 20 pages, if I wanted to make a change it would be hell.
In Bootstrap, I didn't add any kind of active class to any of the selected pages, it was just a navigation bar, I've recently upgraded to the Bulma framework where it requires an active class on the parent tab to show the child tabs, sort of a parent and sub categorys system going on.
I'm not sure how to handle this in the Layout, I need to add an active class and I also need to choose which sub navigation to show.
I've added my code below, I was wondering if anyone could tell me how I can approach this?
The below code is my whole page, including the header (the <section class="hero is-danger inside-header">)
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<title>{{ config('app.name') }} - Login</title>
<link rel="stylesheet" href="assets/public/1.0/frontend/css/bulma.css?id={{ time() }}" type="text/css">
<link rel="stylesheet" href="assets/public/1.0/frontend/css/override.css?id={{ time() }}" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body class="inside">
<section class="hero is-danger inside-header">
<div class="hero-body">
<div class="container">
<div class="columns is-vcentered">
<div class="column is-5">
<p class="title header-title">Introducing {{ config('app.name') }}</p>
<p class="subtitle">Interacting with others...</p>
</div>
<div class="column is-3"></div>
<div class="column is-4">
<a class="button is-danger is-large is-disabled join-game-button">
<i class="fa fa-sign-in"></i> Join Game
</a>
<a class="button is-success is-large is-disabled users-online-button">
<i class="fa fa-users"></i> 10
</a>
<br><br>
<a class="button is-success is-large is-disabled platform-button">Platform: Closed Beta</a>
</div>
</div>
</div>
</div>
<div class="hero-foot">
<div class="container">
<nav class="tabs is-boxed">
<ul>
<li class="is-active">
<a href="/documentation/overview/start/">
<i class="fa fa-user"></i> {{ Auth::user()->username }}
</a>
</li>
<li>
<a href="http://bulma.io/documentation/modifiers/syntax">
<i class="fa fa-university"></i> Business
</a>
</li>
<li>
<a href="http://bulma.io/documentation/columns/basics">
<i class="fa fa-user-secret"></i> Gangs
</a>
</li>
<li>
<a href="http://bulma.io/documentation/elements/box/">
<i class="fa fa-users"></i> Community
</a>
</li>
<li>
<a href="http://bulma.io/documentation/components/breadcrumb/">
<i class="fa fa-shopping-cart"></i> Store
</a>
</li>
</ul>
</nav>
</div>
</div>
</section>
<nav class="navbar has-shadow">
<div class="container">
<div class="navbar-tabs">
<a class="navbar-item is-tab is-active" href="http://bulma.io/documentation/overview/start/">Home</a> <a class="navbar-item is-tab" href="http://bulma.io/documentation/overview/start/">Profile</a> <a class="navbar-item is-tab" href="http://bulma.io/documentation/overview/customize/">Education</a> <a class="navbar-item is-tab" href="http://bulma.io/documentation/overview/classes/">Skills</a> <a class="navbar-item is-tab" href="http://bulma.io/documentation/overview/modular/">Housing</a> <a class="navbar-item is-tab" href="http://bulma.io/documentation/overview/modular/">Security</a>
</div>
</div>
</nav>
<div class="container holorp-container-fixed">
<br>
<div class="columns is-desktop">
<div class="column is-8">
<div class="message is-danger">
<div class="message-body">
<p>not sure what can even go here...</p>
</div>
</div>
</div>
<div class="column is-4">
<div class="message is-success">
<p class="message-header">Change Log <span class="is-pulled-right"><i class="fa fa-user"></i></span></p>
<div class="message-body">
<span class="tag is-dark">26/09/17</span> <code>Updates the platform with a fresh design</code><br>
<span class="tag is-dark">26/09/17</span> <code>Upgraded from Laravel 5.4 to 5.5</code><br>
<span class="tag is-dark">26/09/17</span> <code>Added core features to the admin panel</code><br>
<span class="tag is-dark">26/09/17</span> <code>Did something, can't even remember</code><br>
<br>
<p><a class="modal-button" data-target="#modal-forgotPassword" id="forgot-pw-modal">View all recent changes</a></p>
</div>
</div>
</div>
</div>
</div>
</body>
If I understand well, you need "the same header" on every page. Laravel comes with Blade Template Engine, it has a set of methods to help us.
Using the template engine, you can create your app template in resources/views/layouts/app.blade.php
using #yield you can inform what part is dynamic:
<div class="container">
#yield('content')
</div>
To reuse the template in others views, for example using two pages:
The content of file resources/views/layouts/pages/one.blade.php
#extends('layouts.app')
#section('content')
<div class="row">
<h1>Page 1</h1>
</div>
#endsection
The content of file resources/views/layouts/pages/two.blade.php
#extends('layouts.app')
#section('content')
<div class="row">
<h1>Page 2</h1>
</div>
#endsection
Using #yield, #extends and #section you can reuse any HTML template in your Laravel Application.
We can create any #yield that we need:
<div class="container">
#yield('content')
</div>
#yield('scripts')
And reuse in our pages:
#extends('layouts.app')
#section('content')
<div class="row">
<h1>More than one #yield</h1>
</div>
#endsection
#section('scripts')
<script type="text/javascript" />
console.log('using Blade Template Engine');
</script>
#endsection
There is the #include method, that includes the content of another file if you need.
#extends('layouts.app')
#section('content')
<div class="row">
<h1>Page 2</h1>
#include('forms.form2')
</div>
#endsection
UPDATE:
Knowing these things above, we can do:
#extends('layouts.app')
#section('content')
<div class="row">
<h1>You are in Item B</h1>
<ul>
<li id="liA">Item A</li>
<li id="liB">Item B</li>
<li id="liC">Item C</li>
</ul>
</div>
#endsection
#section('scripts')
<script type="text/javascript" />
var d = document.getElementById("liB");
d.className += " is-active";
</script>
#endsection
This will add the CSS class in the element with id "liB", we need to use something to identify the element, I'm using "id" property but you can use anyone, just need to check what JS method to use to get it in "d" variable. You can check this for more information Element.className
I don't use Bulma, but I believe that will do what you want.
From the research I have done, I think it has to do something with the include() function linking to the nav.php file. What I am trying to accomplish is taking an older huge site with every element being static ones and converting it to have dynamic elements so that the updating is faster. The first step was the nav bar and I can't seem to get it to work.
The route to the nav bar is inputs/nav.php, and I'm trying to use include() to put the nav in:
<?php include("inputs/nav.php"); ?>
It works for the files at the same level as the inputs folder, but if a page is at any other level of files, it does not. Anyone got any ideas of what is going on and how to fix?
Thanks in advance!
<header>
<div id="mastHead">
<div id="fss_logo">
<a href="index.html">
<img src="images_folder/logos/35fss_logo4.png" alt="35 FSS" />
</a>
</div>
<!--End FSS logo-->
<div id="facility_title">
<div id="rotating-item-wrapper_main">
<a href="facebook_links.html" onClick="return popup(this, 'facebook')">
<img id="facebook_logo6" src="images_folder/logos/facebook_circle2.png" alt="Facebook Logo" class="rotating-item" />
</a>
<a href="http://ice.disa.mil/index.cfm?fa=site&site_id=7&dep=DoD" target="_blank">
<img id="ice_logo2" src="images_folder/logos/ice.png" alt="ICE Logo" class="rotating-item" />
</a>
</div>
<!-- END: Rotating images images -->
</div>
<!--End facility_title-->
</div>
<!--End Mast Head-->
<!--------------------------- NAV INCLUDE ----------------------------->
<?php include( "inputs/nav.php"); ?>
<!--------------------------- NAV INCLUDE ----------------------------->
<!-- /nav-wrap -->
</div>
</header>
I have 3 columns in my app. Each column has an unordered list. I am using Nestable to drag and drop list items between lists. The mark up is as follows:
<div class="row-fluid span12">
<div class="cf nestable-lists">
<div id="pjax-content">
<div class="span4">
<div class="dd" id="nestable1">
<ul class="dd-list">
<li class="dd-item dd3-item" data-id="123">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content">
// list content
</div>
</li>
<li class="dd-item dd3-item" data-id="456">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content">
// list content
</div>
</li>
</ul>
</div>
</div>
<div class="span4">
<div class="dd" id="nestable2">
<ul class="dd-list">
<li class="dd-item dd3-item" data-id="789">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content">
// list content
</div>
</li>
<li class="dd-item dd3-item" data-id="1011">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content">
// list content
</div>
</li>
</ul>
</div>
</div>
<div class="span4">
<div class="dd" id="nestable3">
<ul class="dd-list">
<li class="dd-item dd3-item" data-id="1213">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content">
// list content
</div>
</li>
<li class="dd-item dd3-item" data-id="1415">
<div class="dd-handle dd3-handle">Drag</div>
<div class="dd3-content">
// list content
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
This works and I can drag and drop list items between each list. The problem is when I implement PJAX.
I have a few links that use PJAX to change the url i.e. each link will update the data or order of the data in each list based on the URL. The data updates within id="pjax-content" accordingly, so it works. This is a snippet of the server side code (using CI):
if (isset($_SERVER["HTTP_X_PJAX"])) {
echo $data['contents'];
} else {
// construct views when not PJAX
}
$data['contents'] contains the html as a string.
I have the following JS libraries too (I have tried removing some of these and the problem still exists):
<script type="text/javascript" src="jquery-1.9.0.js"></script>
<script type="text/javascript" src="bootstrap.js"></script>
<script type="text/javascript" src="nestable.js"></script>
<script type="text/javascript" src="nestable-settings.js"></script>
<script type="text/javascript" src="bootstrap-editable.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript" src='jquery.pjax.js'></script>
<script type="text/javascript">
$(document).pjax('[data-pjax] a, a[data-pjax]', '#pjax-content');
$(document).on('pjax:send', function() {
console.log("before send");
});
$(document).on('pjax:complete', function() {
console.log("done!");
});
</script>
The Problem
When I click on one of the links PJAX works, the data is updated, the page doesn't reload and the console shows before send and done - so all is well. However, the nestable items are no longer selectable so a I can't drag and drop them. When I do a full page refresh it works and I can drag and drop.
I have compared the markup before and after (as that was a previous issue) and everything is the same.
Any suggestions on where I am going wrong? Or how to best debug this?
call nestable after your ajax complete function
$(document).on('pjax:complete', function() {
$('#nestable1,#nestable2,#nestable3').nestable();
});