0

I'm using ScrollTo.

It is not scrolling to div having margin, margin-left: -1160px; or margin-top: -600px;

I have following div

        <div id="home"  class="content">
            <h1>I'ts home</h1>
        </div>
        <div id="about" class="content"  style="margin-left:-1160px;">
            <h1>I'ts about</h1>
        </div>
        <div id="contact" class="content" style="margin-left:600px;">
            <h1>I'ts Contact</h1>
        </div>
        <div id="services" class="content" style="margin-top:-600px;">
            <h1>I'ts Contact</h1>
        </div>

I want to display home div by default.
All div 100% height and width.

2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by LastMitch
0

@vizz

It is not scrolling to div having margin, margin-left: -1160px; or margin-top: -600px;

Can you tell me which code that you mention does scroll left?

<script type="text/javascript">
$(function(){
// Prepare
var links = [
{
id: 'scrollto1',
text: 'Scroll to #scrollto1'
},
{
id: 'scrollto2',
text: 'Scroll to #scrollto2 with a 2 second duration and "linear" easing.',
options: {
duration: 2000,
easing: 'linear'
}
},
{
id: 'scrollto3',
text: 'Scroll to #scrollto3 with a 2 second duration and durationMode set to "all".',
options: {
duration: 2000,
durationMode: 'all'
}
},
{
id: 'scrollto4',
text: 'Scroll to #scrollto4 with a 2 second duration and a callback on scroll completion.',
options: {
duration: 2000,
callback: function(){
alert('Scrolling has now completed.');
}
}
},
{
id: 'scrollto5',
text: 'Scroll to #scrollto5 with a horizontal scroll'
},
{
id: 'scrollto6',
text: 'Scroll to #scrollto6 only if it is outside the visible area',
options: {
onlyIfOutside: true
}
}
];

// Fetch
var $links = $('#scrollto-links');

// Append Links
$.each(links,function(i,link){
$('<a>'+link.text+'</a>').click(function(){
$('#'+link.id).ScrollTo(link.options);
}).appendTo($links);
});
});
</script>

I can tell you that I don't understand what you are trying to do? I try all 6 scrolls and in order to make it move to the left you have to make the width longer so it can fit all of the div.

0
<script type="text/javascript" language="javascript">
    $(document).ready(function() {

        $(".navlist li a").click(function() {

            var linked=$(this).attr("href");
            $(linked).ScrollTo({duration: 600,easing: 'linear'}); 

        });
    });
</script>

Not scrolling to div when margin-left:-1160px;

0

I found two website what I was trying to create

check this & this

Please Help me to create layout like this

0

@vizz

Please Help me to create layout like this

The website you provide is using either a plugin or a different script.

Can you make it positive margin to be rather than negative margin. I never seen someone do that before.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.